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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! 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-Newbie

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

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
12-Amethyst
(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,

Top Tags