Query device event log

Last Updated on : 2023-06-19 07:06:52

Query device event log

API address

GET: /v1.0/iot-03/devices/{device_id}/logs

Request parameter

Parameter nameTypeINRequiredDescription
device_idStringuritrueDevice ID
event_typesStringquerytrueEvent types supported by log query. Multiple event types are supported, separated by commas (,) and must be transmitted. (1 online, 2 offline, 3 device activation, 4 device reset, 6 Firmware upgrade, 7 data report, 8 device semaphore, 9 device restart, 10 timing information)
start_timeLongquerytrueThe start timestamp of the query, 13 digits
end_timeLongquerytrueThe end timestamp of the query, 13 digits
sizeIntegerqueryfalseThe size of the number of logs to be queried (the default is 20)
query_typeIntegerqueryfalseQuery type, the default is 1, (1 free version, 2 paid version)
last_row_keyStringqueryfalsePagination parameter, last_row_key in the return value of the previous page request, query the first page when the passed parameter is empty

Return parameter

Parameter nameTypeDescription
resultDeviceLogResBasic Pagination Information

Description of result

Parameter nameTypeDescription
last_row_keyStringThe identifier of the current page, which can be used as the lastRowKey parameter value of the next page query
device_idStringDevice id
has_moreBooleanIs there a next page
totalLongTotal number of eligible data
listListData List

Description of list

Parameter nameTypeDescription
event_timeLongEvent Time
event_fromStringThe source of the event trigger: 1 device itself, 2 client instructions, 3 third-party platforms, 4 cloud instructions, -1 unknown
event_idIntegerType of event: 1 online, 2 offline, 3 device activation, 4 device reset, 6 firmware upgrade, 8 device semaphore, 9 device restart, 10 timing information
event_valueStringEvent Value

Request example

GET: /v1.0/iot-03/devices/xxxxx/logs?last_row_key=xxx&event_types=1,2&start_time=1545898159931&end_time=1545898159935&size=20

Error code

For more information, see error code.