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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

how to connect to thingworx platform and get data using nodejs

dmishra
1-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
AdamR
12-Amethyst
(To:dmishra)

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

View solution in original post

4 REPLIES 4
AdamR
12-Amethyst
(To:dmishra)

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

dmishra
1-Newbie
(To:AdamR)

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?

AdamR
12-Amethyst
(To:dmishra)

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.

dmishra
1-Newbie
(To:AdamR)

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

Top Tags