how to connect to thingworx platform and get data using nodejs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
how to connect to thingworx platform and get data using nodejs
how to connect to thingworx platform and get data using nodejs
Solved! Go to Solution.
- Labels:
-
Connectivity
-
Extensions
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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);
