上报属性信息¶
上报属性数据使用的 topic 与 MQTT 协议一致,即 /sys/{productKey}/{deviceKey}/thing/attribute/update
。
上报数据的完整 URL 格式为https://{HTTP_Broker_URL}/topic/sys/{productKey}/{deviceKey}/thing/attribute/update
。其中:
{productKey}
为设备的 product key。{deviceKey}
为设备的 device key。
上报数据请求示例¶
POST /topic/sys/{ProductKey}/{DeviceKey}/thing/attribute/update HTTP/1.1
Host: {HTTP_Broker_URL}
Query-Parameter: sessionId={SessionId}
Content-Type: application/json
body:
{
"id": "123",
"version": "1.0",
"params": {
"attributes": {
"attr1": {
"value": 1.0,
"value2": 9
},
"attr2": 1.02,
"attr3": [1.02, 2.02, 7.93]
}
},
"method": "thing.attribute.update"
}
返回结果示例¶
body:
{
"id": "123",
"code": 200,
"data": {}
}
以上示例中,各参数的说明以及结果返回码信息,参见基于 MQTT 的设备连接的 上报属性信息 的参数说明和结果返回码。