Updated on 2023-11-23 GMT+08:00

Querying a List of End Devices

Function

This API is used to query a list of end devices.

URI

GET /v2/{project_id}/edgemgr/devices?{name=xxx,tags=xxx,limit=xxx,offset=xxx}

Table 1 Path parameter

Parameter

Mandatory

Description

project_id

Yes

Project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

name

No

String

End device name, which supports fuzzy match.

node_id

No

String

Node ID, which supports exact match.

limit

No

String

Number of records displayed on each page. The value range is 1–1000. The default value is 1000.

offset

No

String

Start position for a query. The value is a non-negative integer. The default value is 0.

is_binding

No

String

Whether to bind a device to an edge node. If the value is true, a list of devices that have been bound to a node is returned. If the value is false, a list of devices that are not bound to a node is returned.

tags

No

String

The key and value of a tag are separated by dots (.), and multiple tags are separated by commas (,). For example, tags=key1.value1,key2.value2.

  • If no query parameter is specified, all end devices under an account are returned.
  • tags and node_id can be combined for a compound query. If multiple other query parameters are specified, the edge services that meet all the specified query parameters are returned.
  • is_binding cannot be combined with tags or node_id for a compound query.

Request

Table 3 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

The default value application/json is recommended.

X-Auth-Token

Yes

String

User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response

Response parameters
Table 4 Parameters in the response body

Parameter

Type

Description

devices

Array of Table 6 objects

A list of end devices.

count

Integer

Number of end devices that meet the conditions.

Example response

{
    "devices": [
        {
            "id": "1398f13d-f24d-4de4-8cd3-5905db1d6d9f",
            "name": "device",
            "access_protocol": "",
            "project_id": "05e1aef9040010e22fccc009adecb056",
            "description": "",
            "created_at": "2020-09-23T02:00:22.858736Z",
            "updated_at": "",
            "access_config": {},
            "connection_type": "edge"
        }
    ],
    "count": 1
}

Error Codes

For details, see Error Codes.