cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Set properties via REST API

davidcor
1-Newbie

Set properties via REST API

I am trying to set the value of a thing's property with the following but the value does not change. Not sure what I am doing wrong

https://dev.atavance.com/Thingworx/Things/ThingName/Properties/description?method=put&value=test&appKey=###&x-thingworx-session=true

6 REPLIES 6
smanley
13-Aquamarine
(To:davidcor)

Your HTTP request seems to be correct. Are you using 6.0? If so, some REST calls are disabled by default. They are disabled by default to reduce the possibility of CSRF attacks. If you would like to enable this setting go to your Platform subsystem. This will be under System>subsystems>PlatformSubsystem. Click on configuration and check the box next to "Allow Request Method Switch" and uncheck the box next to "Filter Content-Type."

We are using 6.0.  Would this also apply to running services through the REST API? I've tried to use https:/dev.atavance.com/Thingworx/Things/ThingName/Services/... but that doesn't work either.

What is the recommended way to set property values via REST without introducing security risks?

billrei
5-Regular Member
(To:smanley)

This call should still work in 6.0. You just have to use an actual HTTP put request instead of a get request with method=put.

I'm making the call from a lua script with method=put, but it is still not working

paic
1-Newbie
(To:davidcor)

Already a lot of good answers, as a side note: I see you are using the session = true flag.

Unless you are using an application key to log into a Mashup, do NOT use this.

If you are just putting properties or posting to execute services, do not establish unnecessary sessions.

Maybe you forget the server port? My base URL like

http:TWServer:TWPort/Thingworx/Things/Thing/Properties/Temperature?appkey&method=put&value=50.0

Hopes it would help you.

Top Tags