2 Replies Latest reply on Mar 3, 2017 12:28 AM by Ankit Gupta RSS
    bbulb 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.

      • Re: How to send REST request from Thingworx to outside server/device?
        dbujoreanu Newbie

        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

        • Re: How to send REST request from Thingworx to outside server/device?
          Ankit Gupta Ninja

          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