ListThings
Updated at:
Copy as MD
Call this API to list all devices and their statuses. You can pass a ProductKey to list only devices of a specific product, or pass both a ProductKey and a DeviceName to retrieve a specific device.
Request syntax
GET /2020-04-30/things?productkey=ProductKey&devicename=DeviceName HTTP/1.1
Cookie: CookieImportant
2020-04-30 is the version number of the edge OpenAPI. This value cannot be changed.Request parameters
| Parameter | Type | Required | Description |
| ProductKey | String | No | The unique identifier of the product to which the device belongs. |
| DeviceName | String | No | The device name. |
| Cookie | String | Yes | The authentication cookie created by calling the CreateAuthCookie API. |
Return syntax
HTTP/1.1 StatusCode
Content-Type: application/json
PayloadResponse parameters
| Parameter | Type | Description |
| StatusCode | Number | The API status code. A value of 200 indicates that the call is successful. Other values indicate that the call failed. For more information, see Status codes. |
| Payload | JSON | The retrieved device information. |
The response payload has the following format.
{
"Data": {
"Things": [{
"ProductName": "string",
"ProductKey": "string",
"DeviceName": "string",
"DriverId": "string",
"DriverName": "string",
"Tags": [{"string": "string"}],
"Status": "Inactivated|Failed|Online|Offline",
"Connected": true|false,
"ConnectTime": "string"
}]
}
}Example
$ curl -i -b token.cookie -k https://127.0.0.1:9999/2020-04-30/things
HTTP/1.1 200 OK
Server: openresty/1.13.6.2
Date: Wed, 22 Apr 2020 15:18:16 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
{"Data":{"Things":[{"DriverName":"LightSensor","Status":"Online","NickName":"","DriverId":"e0bb1b48964e4519b4a52f9b****1dd3","ProductKey":"a1t****n42K","Connected":true,"ConnectTime":"1587526047107","DeviceName":"GjCb9LKXgcKXel******","ProductName":"","Tags":[]}]}}Is this page helpful?