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 the Community Ranking System, a fun gamification element of the PTC Community. X

How to send REST request from Thingworx to outside server/device?

bbulb
1-Newbie

How to send REST request from Thingworx to outside server/device?

Hi,

Thingworx REST API are all about from outside server/device invoke API to Thingworx, but how to send a REST API from Thingworx to external server/device? for example, send request to actuator to control it

Thanks.

2 REPLIES 2

Hello,

You can create a service for a Thing where you can  issue an HTTP request using any of the allowed actions (GET, POST, PUT, DELETE) using the available option from the ContentLoaderFunctions library, i.e. PostXML or GetXML, then in the script itself you can specify all the parameters of the REST call such as the URL yo connect to, the headers, content, username and password, whether to use a proxy or not. Basically all the same inputs you'd need to provide to a browser or desktop based REST client. Also the output of the particular service will have to be XML or HTML and either assign it to a property for later inspection and validation of the outcome or you can do all the validation in the same service and return whatever result you need.

The basic idea being that the ContentLoaderFunctions library has all the functions which should allow you build, request and process a REST call to a remote web service.

Hope this helps.

Regards,

Denis

ankigupta
5-Regular Member
(To:bbulb)

Hi bulb bulb

Please check following blog post for which explains How to do a Rest call to external Applications ContentLoaderFunctions in ThingWorx

I hope it helps.

Thanks,

Ankit Gupta

Top Tags