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

how to connect to thingworx platform and get data using nodejs

SOLVED
Newbie

how to connect to thingworx platform and get data using nodejs

how to connect to thingworx platform and get data using nodejs

1 ACCEPTED SOLUTION

Accepted Solutions

Re: how to connect to thingworx platform and get data using nodejs

Dibya,

The simplest mechanism to communicate with nodejs would be to use REST calls.  All Thingworx services and structures are available using REST calls (as long as the appropriate security structures are setup).

The base description of the REST structure can be found here...

http://support.ptc.com/cs/help/thingworx_hc/thingworx_6.0_hc/index.jspx?id=thingworx1001&action=show

Thanks,

Adam

4 REPLIES 4

Re: how to connect to thingworx platform and get data using nodejs

Dibya,

The simplest mechanism to communicate with nodejs would be to use REST calls.  All Thingworx services and structures are available using REST calls (as long as the appropriate security structures are setup).

The base description of the REST structure can be found here...

http://support.ptc.com/cs/help/thingworx_hc/thingworx_6.0_hc/index.jspx?id=thingworx1001&action=show

Thanks,

Adam

Re: how to connect to thingworx platform and get data using nodejs

thanks for the suggestion.

I want to know if the  value of the property of a thing changes how will node know without continuous  polling to the thingworx server?

Re: how to connect to thingworx platform and get data using nodejs

You would need to code a REST call back to the nodejs server inside a data change subscription in the Thingworx Platform.  There are Snippets in our Resouces for ContentLoaderFunctions that structure a rest call from Thingworx code.

Highlighted

Re: how to connect to thingworx platform and get data using nodejs

i want to send the new property values to the nodejs.

which one should i use postJson,getJson?

and what should be the parameter?

var header={

     'Content-Type': 'application/json'

};

var params = {

proxyScheme: undefined /* STRING */,

headers: header /* JSON */,

ignoreSSLErrors: true /* BOOLEAN */,

useNTLM: false /* BOOLEAN */,

workstation: undefined /* STRING */,

useProxy: false /* BOOLEAN */,

withCookies: undefined /* BOOLEAN */,

proxyHost: undefined /* STRING */,

url: "http://192.168.186.117:3000" /* STRING */,

content: undefined /* JSON */,

timeout: 5000 /* NUMBER */,

proxyPort: undefined /* INTEGER *//* STRING */,

    domain: "http://192.168.186.117:3000" /* STRING */,

password: "admin" /* STRING */, 

username: "Administrator" /* STRING */

};

// result: JSON

var result = Resources["ContentLoaderFunctions"].PostJSON(params);