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

Fetching data from external REST API/websockets

Sri1
14-Alexandrite

Fetching data from external REST API/websockets

I wanted to set the position(Lat-Lng) properties of a Thing,  by fetching data from an external Rest APT/Websockets.

I want this process to be continues.Where and how can we achieve this?( Through Events or Services or Subscriptions)

 

 

3 REPLIES 3
rjanardan
16-Pearl
(To:Sri1)

You could use Services->Snippets->Resources->ContentLoaderFunctions( e.g GetJSON) to make the REST call. This service could then be called from a Subscription which in turn would be triggered by a Timer Event(emitted by a thing implementing Timer Thing Template), to have this call made periodically. 

Sri1
14-Alexandrite
(To:rjanardan)

Hi rjanardan,

 

I wrote a service for REST API fetch at the location specified by you.

I am new in thingworx programming,

 1) How do i call this service to check my code.

 2) How do i call this service from the subscription.

3) Is there any example or tutorial link that i can go through, to successfully follow the steps you have provided.

 

Thanks and regards,

Sri1

 

raluca_edu
17-Peridot
(To:Sri1)

Hi,

 

Please check also this article https://www.ptc.com/en/support/article?n=CS228529

You will find more references on how to use REST API.

 

Regards,

Raluca Edu

Announcements


Top Tags