网关上报子设备属性
接口说明
用于批量设备上报属性数据给平台。网关设备可以用此接口同时上报最多50个子设备的属性数据。
URI
|
请求方法 |
POST |
|---|---|
|
URI |
/v5/devices/{device_id}/sys/gateway/sub-devices/properties/report |
|
传输协议 |
HTTPS |
请求参数
|
名称 |
必选 |
类型 |
位置 |
说明 |
|---|---|---|---|---|
|
access_token |
是 |
String |
Header |
参数解释: 调用设备鉴权信息返回的access_token 取值范围: 长度1-256。 |
|
device_id |
是 |
String |
Path |
参数说明: 设备ID,用于唯一标识一个设备。在注册设备时直接指定,或者由物联网平台分配获得。由物联网平台分配时,生成规则为"product_id" + "_" + "node_id"拼接而成。 取值范围: 长度不超过128,只允许字母、数字、下划线(_)、连接符(-)的组合。 |
|
devices |
是 |
List<DeviceProperty> |
Body |
参数解释: 设备数据列表。 取值范围: 长度不超过50。 |
|
名称 |
必选 |
类型 |
说明 |
|---|---|---|---|
|
device_id |
是 |
String |
参数解释: 子设备的设备ID,用于唯一标识一个设备,在注册设备时由物联网平台分配获得。 取值范围: 长度不超过128,只允许字母、数字、下划线(_)、连接符(-)的组合。 |
|
services |
是 |
List<ServiceProperty> |
参数解释: 设备服务数据列表。 |
请求示例
POST https://{endpoint}/v5/devices/{device_id}/sys/gateway/sub-devices/properties/report
Content-Type: application/json
access_token: ******
{
"devices" : [ {
"device_id" : "deviceId_0001",
"services" : [ {
"service_id" : "serviceId",
"properties" : {
"Height" : 124,
"Speed" : 23.24
},
"event_time" : "2021-08-13T10:10:10.555Z"
} ]
}, {
"device_id" : "deviceId_0002",
"services" : [ {
"service_id" : "serviceId",
"properties" : {
"Height" : 124,
"Speed" : 23.24
},
"event_time" : "2021-08-13T10:10:10.555Z"
} ]
} ]
}
响应示例
Status Code: 200 上报正常
错误码
|
HTTP状态码 |
HTTP状态码描述 |
错误码 |
错误码描述 |
错误码中文描述 |
|---|---|---|---|---|
|
400 |
Bad Request |
IOTDA.000006 |
Invalid input data. |
请求参数不合法 |
|
IOTDA.021104 |
Subdevices in the request does not exist or does not belong to the gateway. |
请求中有部分子设备不存在或不属于该网关. |
||
|
403 |
Forbidden |
IOTDA.000004 |
Invalid access token. |
非法token |
|
IOTDA.021101 |
Request reached the maximum rate limit. |
请求已经达到限制速率 |
||
|
IOTDA.021102 |
The request rate has reached the upper limit of the tenant, limit %s. |
请求已经达到租户的限制速率 |
||
|
IOTDA.021103 |
The request batch properties number has reached the upper limit, limit %s. |
请求中子设备数量达到上限 |
||
|
IOTDA.021105 |
The content reported in a single request cannot exceed 1 MB. |
单次请求上报的内容不能超过1MB |