Get Status Reporting Log

Last Updated on : 2024-06-29 01:23:59download

Based on the device ID, get the logs that the device status is reported.

API address

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

Request parameter

Parameter nameTypeINRequiredDescription
device_idStringpathtrueThe device ID.
codesStringquerytrueThe codes of data points supported by the device. You can query multiple data points, separated with commas (,). This parameter value is empty by default.
start_timeLongquerytrueThe timestamp of the start time for a query.
end_timeLongquerytrueThe timestamp of the end time for a query.
last_row_keyStringqueryfalseThe row key of the last entry on each page. The default value is empty, which means the first page.
sizeIntegerquerytrueThe number of logs allowed to be returned. Default value: 20. Recommended value: less than 100.

Return parameter

Parameter nameTypeDescription
last_row_keyStringThe identifier of the current page. It can be used as the lastRowKey parameter value to query the next page.
device_idStringThe device ID.
has_moreBooleanSpecifies whether to return the next page.
totalLongThe total entries of data that meets the criteria.
logsListThe list of logs.

Description of logs

Parameter nameTypeDescription
codeStringThe code of the specified event.
valueObjectThe status value.
event_timeLongThe time when an event occurred.

Request example

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

Return example

{
    "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
}

Error code

For more information, see error code.

Limits on API Request Frequency

For more information, see Limits on API Request Frequency.