Last Updated on : 2024-01-30 09:30:31download
Get logs of events such as device online, offline, activation, and reset.
GET: /v1.0/iot-03/devices/{device_id}/logs
Parameter name | Type | IN | Required | Description |
---|---|---|---|---|
device_id | String | uri | true | The device ID. |
event_types | String | query | true | The supported types of events in the logs. You can query multiple event types, separated with commas (,). This parameter value is required. Valid values:
|
start_time | Long | query | true | The 13-digit timestamp of the start time for a query. |
end_time | Long | query | true | The 13-digit timestamp of the end time for a query. |
size | Integer | query | false | The number of logs to be queried. Default value: 20 . |
query_type | Integer | query | false | The query type. Valid values:
|
last_row_key | String | query | false | The last row key when you query logs by page. The value is from the last_row_key of the returned result. When the value is empty, it means to query the first page. |
Parameter name | Type | Description |
---|---|---|
result | DeviceLogRes | The basic information by page. |
Description of result
Parameter name | Type | Description |
---|---|---|
last_row_key | String | The identifier of the current page. It can be used as the last_row_key parameter value to query the next page. |
device_id | String | The device ID. |
has_more | Boolean | Specifies whether to return the next page. |
list | List | The list of data. |
Description of list
Parameter name | Type | Description |
---|---|---|
event_time | Long | The time when an event occurred. |
event_from | String | The source that triggers the specified event. Valid values:
|
event_id | Integer | The event type. Valid values:
|
event_value | String | The event value. |
GET: /v1.0/iot-03/devices/xxxxx/logs?last_row_key=xxx&event_types=1,2&start_time=1545898159931&end_time=1545898159935&size=20
{
"result": {
"last_row_key": "xxxxxxxxxxxxx",
"device_id": "75500780ecfabc9a****",
"has_next": true,
"logs": [
{
"code": "switch_1",
"event_from": "1",
"event_id": 7,
"value": "false",
"event_time": 1560872567955
}
]
},
"t": 1561344464370,
"success": true
}
For more information, see error code.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback