0

I am looking for an example on how to use the Intel Edison with Cumulocity through Node.js. Is there any Node.js sample code available?

André
  • 668
  • 6
  • 11

1 Answers1

0

You can use Cumulocity REST API in Node.js script like in the following example:

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

For available endpoints see REST documentation here: http://www.cumulocity.com/guides/rest/introduction/.

user485332
  • 161
  • 1
  • 1
  • 10