cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Use REST to external URL to update Thing property?

Highlighted
Contributor

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

Tags (2)
1 REPLY 1

Re: Use REST to external URL to update Thing property?

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);