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

How to build a service in order to get data (in the form of JSON) from a Web Service and bind it to the properties of a thing automatically.

psaxena
1-Visitor

How to build a service in order to get data (in the form of JSON) from a Web Service and bind it to the properties of a thing automatically.

Build a service which receives a response from a web service and the values which it gets in the response(JSON) are binded to the properties of a Thing.

3 REPLIES 3
SajidPatel
12-Amethyst
(To:psaxena)

Can you provide more details on the usecase? There might be an alternate solution to achieve what is intended.

To answer the question directly - the service can set the property on the Thing directly.

If the service is written in the same thing -- me.myproperty=<value>

or Thing["myThing"].myproperty=<value>

ttielebein
14-Alexandrite
(To:psaxena)

Look for the service PostJSON which takes as its parameter an external web URL.It should be on the ContentLoaderFunctions Resource. The web interface you are requesting has to be RESTful, I believe.

Hope this helps!

Tori

Hi Priyanshi,

You got the answers in the reverse order

First, as Tori said, look at ContentLoaderFunctions Resources, where you have plenty of services to call remote web services ( REST calls: POST, GET, DELETE,... , PostJSON/Text/XML, GetJSON/Text... ).

Then once received the result and parsed accordingly depending on your remote web service, you can use what Sajid said, set Thing current properties ( me.propertyName=value, or another thing Things["thingName"].propertyName = value; )

Best Regards,

Announcements


Top Tags