Node.js を介して Intel Edison と Things Cloud を使用する方法の例を探しています。Node.js のサンプル コードはありますか?
1 に答える
0
次の例のように、Node.js スクリプトで Things Cloud 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/。
于 2015-07-27T08:26:18.420 に答える