Skip to main content
1-Visitor
July 22, 2015
Question

Set properties via REST API

  • July 22, 2015
  • 3 replies
  • 3895 views

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

3 replies

5-Regular Member
July 22, 2015

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."

davidcor1-VisitorAuthor
1-Visitor
July 22, 2015

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?

1-Visitor
July 23, 2015

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.

1-Visitor
February 25, 2016

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.