Skip to main content
1-Visitor
May 17, 2016
Solved

Put multiple data in one request

  • May 17, 2016
  • 2 replies
  • 2586 views

     Hi, I'm using http rest API by ArduinoYun. The question is, I want to send mutiple data to thingworx in one request. For example, I want to send temperautre and humidity to thongworx, now I use two request such as

curl http://zucc.cloud.thingworx.com:80/Thingworx/Things/DHT21Thing/Properties/Temperature?appKey=deaf648e-e691-4e9e-88a9-1a8…

curl http://zucc.cloud.thingworx.com:80/Thingworx/Things/DHT21Thing/Properties/Humidity?appKey=deaf648e-e691-4e9e-88a9-1a80b21145c3&method=put&value=66

I think maybe it could be zipped. Am i right?

Best answer by PaiChung

You can use a PUT to send multiple values, with the Values object defined as a JSON.

Here is the article that outlines it.

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS211045&art_lang=en&posno=8&q=rest%20api&ProductFamily=ThingWo…

2 replies

PaiChung22-Sapphire IAnswer
22-Sapphire I
May 17, 2016

You can use a PUT to send multiple values, with the Values object defined as a JSON.

Here is the article that outlines it.

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS211045&art_lang=en&posno=8&q=rest%20api&ProductFamily=ThingWo…

aalbot1-VisitorAuthor
1-Visitor
May 18, 2016

Hi Pai,

Like this?

curl "http://zucc.cloud.thingworx.com:80/Thingworx/Things/DHT21Thing/Properties/*?appKey=deaf648e-e691-4e9e-88a9-1a80b21145c3" -X PUT -i -H "Content-Type:application/json" -H "Accept:application/json" -d '{"Temperature" : 44, "Humidity" : 44}'

Thankyou,

Angel

1-Visitor
May 31, 2016

Hi,

U can use put method

eg:

1. Use a property called: "test"

2. Set the property as "23|66" that is temp=23 and Hum=66

3. Then write a service called "Logservice" for splitting this pipped value

URL:

http://zucc.cloud.thingworx.com:80/Thingworx/Things/DHT21Thing/Properties/test?appKey=deaf648e-e691-4e9e-88a9-1a80b21145c3&method=put&value=23|66

and fire the Service URL

http://zucc.cloud.thingworx.com:80/Thingworx/Things/DHT21Thing/Services/logservice?appKey=deaf648e-e691-4e9e-88a9-1a80b21145c3&method=post