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: Cookie
Important 2020-04-30 is the version number of the edge OpenAPI. This value cannot be changed.

Request parameters

ParameterTypeRequiredDescription
ProductKeyStringNoThe unique identifier of the product to which the device belongs.
DeviceNameStringNoThe device name.
CookieStringYesThe authentication cookie created by calling the CreateAuthCookie API.

Return syntax

HTTP/1.1 StatusCode
Content-Type: application/json

Payload

Response parameters

ParameterTypeDescription
StatusCodeNumberThe 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.
PayloadJSONThe 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":[]}]}}