1 Reply Latest reply on Feb 21, 2017 8:23 AM by Ankit Gupta RSS
    jamesso Apprentice

    Use REST to external URL to update Thing property?

    I am using Texas Instruments Sensortags as things. I want to model them as ThingWorx things.

     

    I have an external cloud server that is storing properties of the sensors in the Sensortag.

     

    I have a REST API that I can use to get these property values from this server. I can execute the API via curl or postman just fine. REST get commands are used.

     

    I am looking for an example of use REST to set properties of the Sensortag modeled in ThingWorx. I have seen some examples when the REST calls are made to the Edge Micro Server (EMS). But I am not using EMS here.

     

    Is it the same?

     

    A code snippet would be much appreciated. Or a link to a ThingWorx document where this is discussed.

     

    Thanks,

     

    Jim

      • Re: Use REST to external URL to update Thing property?
        Ankit Gupta Ninja

        JAMES SOLDERITSCH, If i understand your requirement clearly, you can use getJSon and other related Snippets based on the return type to get data using Rest from other Systems to ThingWorx.

        To find the snippets, just create a Thing -> Service (create) and open Snippet tab and search for getJSON

         

        example:

        var params = {
          proxyScheme: undefined /* STRING */,
          headers: undefined /* JSON */,
          ignoreSSLErrors: undefined /* BOOLEAN */,
          useNTLM: undefined /* BOOLEAN */,
          workstation: undefined /* STRING */,
          useProxy: undefined /* BOOLEAN */,
          withCookies: undefined /* BOOLEAN */,
          proxyHost: undefined /* STRING */,
          url: undefined /* STRING */,
          timeout: undefined /* NUMBER */,
          proxyPort: undefined /* INTEGER */,
          password: undefined /* STRING */,
          domain: undefined /* STRING */,
          username: undefined /* STRING */
        };
        
        
        // result: JSON
        var result = Resources["ContentLoaderFunctions"].GetJSON(params);