SearchThings
Updated at:
Searches for devices based on specified filter conditions.
Request syntax
POST /2020-04-30/things/search HTTP/1.1
Cookie: Cookie
PayloadImportant
2020-04-30 is the version number of the edge OpenAPI. This value cannot be changed.Request parameters
| Parameter | Type | Required | Description |
| Cookie | String | Yes | The authentication cookie created by calling the CreateAuthCookie operation. |
| Payload | JSON | Yes | A JSON-formatted string. You can search for devices only by tag. Set multiple tags to find devices that match all of them. For the format, see the request payload format below this table. |
The request payload is in the following format.
{
"Tags": {
"Key1": "value1",
"Key2": "value2"
...
}
}Return Syntax
HTTP/1.1 StatusCode
Content-Type: application/json
PayloadResponse parameters
| Parameter | Type | Description |
| StatusCode | Number | The HTTP status code. A status code of 200 indicates that the request was successful. Other status codes indicate that the request failed. For more information about error codes, see Status codes. |
| Payload | JSON | Information about the devices that are found. |
The response payload is in the following format.
{
"Data": {
"Things": [{
"ProductName": "string",
"ProductKey": "string",
"DeviceName": "string",
"DriverId": "string",
"DriverName": "string",
"Tags": [{"Key1": "Value1"}],
"Status": "Inactivated|Failed|Online|Offline",
"Connected": true|false,
"ConnectTime": "string"
}]
}
}Complete example
$ curl -i -b token.cookie -d '{"Tags":{"Name":"LightSensor"}}' -k -X POST https://127.0.0.1:9999/2020-04-30/things/search
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":"test","ProductName":"","Tags":{"Name":"LightSensor"}}]}}Is this page helpful?