设备接入 IOTDA-使用Postman调测:调测“创建产品”接口

时间:2024-07-30 11:30:47

调测“创建产品”接口

在设备接入 物联网平台 前,应用服务器需要调用此接口创建产品,后续注册设备时需要使用这里创建的产品。

应用服务器需要构造一个请求,请求示例如下:

POST https://iotda.cn-north-4.myhuaweicloud.com/v5/iot/{project_id}/products
Content-Type: application/json
X-Auth-Token: ********

{
  "name" : "Thermometer",
  "device_type" : "Thermometer",
  "protocol_type" : "MQTT",
  "data_format" : "binary",
  "manufacturer_name" : "ABC",
  "industry" : "smartCity",
  "description" : "this is a thermometer produced by Huawei",
  "service_capabilities" : [ {
    "service_type" : "temperature",
    "service_id" : "temperature",
    "description" : "temperature",
    "properties" : [ {
      "unit" : "centigrade",
      "min" : "1",
      "method" : "R",
      "max" : "100",
      "data_type" : "decimal",
      "description" : "force",
      "step" : 0.1,
      "enum_list" : [ "string" ],
      "required" : true,
      "property_name" : "temperature",
      "max_length" : 100
    } ],
    "commands" : [ {
      "command_name" : "reboot",
      "responses" : [ {
        "response_name" : "ACK",
        "paras" : [ {
          "unit" : "km/h",
          "min" : "1",
          "max" : "100",
          "para_name" : "force",
          "data_type" : "string",
          "description" : "force",
          "step" : 0.1,
          "enum_list" : [ "string" ],
          "required" : false,
          "max_length" : 100
        } ]
      } ],
      "paras" : [ {
        "unit" : "km/h",
        "min" : "1",
        "max" : "100",
        "para_name" : "force",
        "data_type" : "string",
        "description" : "force",
        "step" : 0.1,
        "enum_list" : [ "string" ],
        "required" : false,
        "max_length" : 100
      } ]
    } ],
    "option" : "Mandatory"
  } ],
  "app_id" : "jeQDJQZltU8iKgFFoW060F5SGZka"
}

参考API文档,调测物联网平台创建产品接口。

:在以下步骤中,只呈现样例调测用到的参数。

  1. 配置“创建产品”接口的HTTP方法URLHeaders

  2. 配置“创建产品”接口的BODY。

  3. 单击“Send”,在下方查看返回码和响应消息内容。

  4. 将返回的“product_id”更新到“IoTDA”环境中的“product_id”参数中,用于后续其它接口使用。

    注:在postman中自动更新了“product_id”参数,使用时无需手动操作。

support.huaweicloud.com/devg-iothub/iot_02_4008.html