Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
how to connect to thingworx platform and get data using nodejs
Solved! Go to Solution.
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
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
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?
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.
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);