Skip to main content
1-Visitor
April 27, 2016
Question

Issue with simple POST to REST API. Like others on this site I am trying to post a simple value via rest. I am utilizing the following "POST /Thingworx/Things/arduinoTestThing/Services/arduinoTestService?appKey=XXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&method

  • April 27, 2016
  • 1 reply
  • 2749 views

Like others on this site I am trying to post a simple value via rest.

I am utilizing the following "POST /Thingworx/Things/arduinoTestThing/Services/arduinoTestService?appKey=XXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&method=post&x-thingworx-session=true<&arduino_value1=45.00> HTTP/1.1 Host: iotb.cloud.thingworx.com Content-Type: text/html" .

While this works on a Development server instance utilizing Composer 6 (after allow REST in PlatformSubSystem) it does not work on my instance which utilizes Composer 5.2. I have view logs etc but no errors are thrown up -- but the Things property is not up dated.

The response from my server instance is "HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Set-Cookie: JSESSIONID=C7C687C119B628A9ACEF2D24A9DE662B; Path=/Thingworx/; HttpOnly Expires: 0 Cache-Control: no-store, no-cache Cache-Control: post-check=0, pre-check=0 Pragma: no-cache Content-Type: text/html;charset=UTF-8 Transfer-Encoding: chunked Date: Wed, 27 Apr 2016 13:44:18 GMT  0"

Many thanks

1 reply

22-Sapphire I
April 28, 2016

To do property values, you need to use a PUT

ismyth1-VisitorAuthor
1-Visitor
April 29, 2016

Thanks Pai

I modified it to PUT and changed the syntax to

PUT /Thingworx/Things/arduinoTestThing/Services/arduinoTestService?appKey=XXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&method=put&x-thingworx-session=true<&arduino_value1=45.00> HTTP/1.1 Host: iotb.cloud.thingworx.com Content-Type: text/html

This had no effect. I have used POST previously on a Developer Instance of Thingworx server using composer 6 and the POST method work.

thanks

Ivan

ismyth1-VisitorAuthor
1-Visitor
April 29, 2016

Hi Pai

Just to be clear I am trying to invoke a service with the POST