设备 - 属性 - 属性查询

大约 2 分钟

设备 - 属性 - 属性查询

属性查询

sys/{product_id}/{device_id}/thing/properties/get

说明:

物联网平台用于查询设备属性

示例:

{
    "id": "123",
    "version": "1.0",
    "params": [
        "temperature",
        "test:Power"
    ],
    "method": "thing.properties.get"
}

字段说明:

参数类型说明
idString消息ID,用于标识每一条Payload,每个消息ID在当前设备中具有唯一性
versionString协议版本号,目前协议版本号唯一取值为1.0
paramsString[]要进行属性查询的设备参数名列表,若查询的设备参数为非默认模块的参数,需要使用冒号进行区分
methodString请求方法。例如:thing.properties.get

属性查询回复

sys/{product_id}/{device_id}/thing/properties/get/response

成功返回示例:

{
    "code": 200,
    "data": {
        "params": {
            "temperature": 23.6,
            "test:Power": 1
        }
    },
    "id": "123",
    "message": "success",
    "method": "thing.properties.get",
    "version": "1.0"
}

失败返回示例:

{
    "code": 460,
    "data": {},
    "id": "123",
    "message": "request parameter error!",
    "method": "thing.properties.get",
    "version": "1.0"
}

说明

设备端响应属性查询结果

字段说明:

参数类型说明
idString消息ID号,String类型的数字,取值范围0~4294967295,且每个消息ID在当前设备中具有唯一性。
codeInteger结果状态码。 具体参考设备端通用code
说明 物联网平台会对设备上报的属性做校验。通过产品的TSL描述判断上报的属性是否符合定义的属性格式。不合格的属性会直接被过滤掉,并返回失败的错误码。
dataObject请求成功时,返回的数据固定为查询到的设备参数值。
messageString返回结果信息。请求成功时,返回success。
methodString响应数据对应的请求方法,与请求参数中method相同。
versionString协议版本号,与请求参数中version相同。