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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

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=post

ismyth
1-Visitor

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=post

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

5 REPLIES 5
PaiChung
22-Sapphire I
(To:ismyth)

To do property values, you need to use a PUT

ismyth
1-Visitor
(To:PaiChung)

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

ismyth
1-Visitor
(To:ismyth)

Hi Pai

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

ismyth
1-Visitor
(To:ismyth)

Discovered the issue is not with the HTTP POST

The issue actually appears to be the the service is not setting a desired property. When I use the the test function on the service (javascript Temp=parseFloat(arduino_value1). The test passes but the Temp property does not get set. I am using composer 5. On composer 6 (on a developer zone instance) the same setup and script works fine!

ismyth
1-Visitor
(To:ismyth)

Hi

Found my issue. Did not specify the Thing the that property belonged to.

Many thanks

Issue closed

Announcements
Top Tags