【问题标题】:Using an Intel Edison and Node.js with Cumulocity使用带有 Cumulocity 的 Intel Edison 和 Node.js
【发布时间】:2015-07-27 16:26:18
【问题描述】:

我正在寻找有关如何通过 Node.js 使用 Intel Edison 和 Cumulocity 的示例。是否有可用的 Node.js 示例代码?

【问题讨论】:

    标签: node.js intel-edison cumulocity


    【解决方案1】:

    您可以在 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/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-01
      • 2016-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多