获取设备状态上报日志

更新时间:2023-11-23 06:26:35下载pdf

本文介绍获取设备状态上报日志的 API。

接口描述

根据设备 ID,获取设备状态上报日志。

接口地址

GET: /v2.0/cloud/thing/{device_id}/report-logs

请求参数

参数名类型参数位置是否必填说明
device_idStringpathtrue设备 ID。
codesStringquerytrue设备支持的功能点。支持多个功能点的查询,用半角逗号(,)隔开,默认为空。
start_timeLongquerytrue查询的开始时间戳。
end_timeLongquerytrue查询的结束时间戳。
last_row_keyStringqueryfalse最后一条数据的行键。默认值为空,查第一页。
sizeIntegerquerytrue查询的日志数量大小。默认值为 20 ,查询条数建议小于100

返回参数

参数名类型说明
last_row_keyString当前页的标识,可作为下一页查询的请求 lastRowKey 参数值。
device_idString设备 ID。
has_moreBoolean是否有下一页。
totalLong符合条件的数据总条数。
logsList日志列表。

logs 说明

参数名类型说明
codeString事件编码。
valueObject状态值。
event_timeLong事件时间。

请求示例

GET: /v2.0/cloud/thing/{{device_id}}/report-logs?codes=switch_led_1&start_time=1676944806000&end_time=1677141431000&last_row_key=&size=20

返回示例

{
    "tid": "939b81a5b3eb11ed887edada9ae0bcf6",
    "result": {
        "device_id": "vdevo167115422036***",
        "total": 1000,
        "has_more": false,
        "logs": [
            {
                "code": "switch_led_1",
                "value": "true",
                "event_time": 1677141419268
            },
            {
                "code": "switch_led_1",
                "value": "false",
                "event_time": 1677141418601
            },
            {
                "code": "switch_led_1",
                "value": "true",
                "event_time": 1677141398699
            }
        ]
    },
    "t": 1677205989547,
    "success": true
}

错误码

参考 错误码

调用频率限制

参考 调用频率限制