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

Querying a List of End Device Templates

Function

This API is used to query a list of end device templates.

URI

GET /v2/{project_id}/edgemgr/device-templates?{name=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 Optional query parameters

Parameter

Mandatory

Type

Description

name

No

String

End device name, which supports fuzzy match.

offset

No

String

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

limit

No

String

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

  • If no query parameter is specified, all device templates of an account are returned.
  • If multiple query parameters are specified, the device templates that meet all the specified query parameters are returned.

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

count

Integer

Number of templates.

device_templates

Array of Table 7 objects

Details about the end device template.

Example response

{
    "count": 1,
    "device_templates": [
        {
            "property_visitors": {},
            "description": "",
            "tags": {
                "key1": "value1"
            },
            "created_at": "2019-10-09T00:51:11.890571+08:00",
            "updated_at": null,
            "access_protocol": "userdefine",
            "twin": {},
            "attributes": {
                "ggg": {
                    "optional": true,
                    "value": "ggg",
                    "metadata": {
                        "type": "string"
                    }
                }
            },
            "project_id": "13b43583216e426b9dc9fad4000e9e1a",
            "id": "3950b024-7716-4580-8b85-4ab4bd3eeef0",
            "name": "mmmmmmm"
        }
    ]
}

Error Codes

For details, see Error Codes.