我正在寻找如何通过Node.js将英特尔爱迪生与Cumulocity结合使用的示例。有没有可用的Node.js示例代码?
发布于 2015-07-27 08:26:18
您可以在Node.js脚本中使用Cumulocity REST API,如下所示:
var request = require('request'),
host = 'http://developer.cumulocity.com/',
auth = {
user: 'tenant/user',
pass: 'password',
sendImmediately: true
};
request({
url: host + 'inventory/managedObjects',
auth: auth,
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: {
name: 'My new device',
type: 'My device type',
c8y_IsDevice: {}
},
json: true
});
有关可用的端点,请参阅此处的REST文档:http://www.cumulocity.com/guides/rest/introduction/。
https://stackoverflow.com/questions/31633657
复制