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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Put multiple data in one request

aalbot
12-Amethyst

Put multiple data in one request

     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?

ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:aalbot)

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…

View solution in original post

3 REPLIES 3
PaiChung
22-Sapphire I
(To:aalbot)

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…

aalbot
12-Amethyst
(To:PaiChung)

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

sv
1-Visitor
1-Visitor
(To:aalbot)

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

Announcements
Top Tags