Skip to main content
1-Visitor
October 30, 2019
Question

Fetching data from external REST API/websockets

  • October 30, 2019
  • 3 replies
  • 1442 views

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

16-Pearl
October 30, 2019

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. 

Sri11-VisitorAuthor
1-Visitor
November 13, 2019

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
November 13, 2019

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