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

Updating an End Device

Function

This API is used to update an end device.

URI

PUT /v2/{project_id}/edgemgr/devices/{device_id}

Table 1 Path parameters

Parameter

Mandatory

Description

project_id

Yes

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

device_id

Yes

Device ID.

Request

Request parameters

Table 2 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.

Table 3 Parameters in the request body

Parameter

Mandatory

Type

Description

device

Yes

Table 4 object

End device information.

Table 4 device

Parameter

Mandatory

Type

Description

description

No

String

End device description. The description contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\

attributes

No

Object

Static properties of an end device. A maximum of 64 key-value pairs are supported.

The key indicates the property name. For details about the format of value, see Table 6. The following is an example:

"attributes": {
            "username": {
                "value": "test",
                "optional": true,
                "metadata": {
                    "type": "string"
                }
            }
        }

Example request

{
    "device": {
        "description": "new description",
        "attributes": {
            "username": {
                "optional": true,
                "value": "test-new",
                "metadata": {
                    "type": "string"
                }
            }
        }
    }
}

Response

Response parameters

Table 5 Parameters in the response body

Parameter

Type

Description

device

Table 6 object

Details about the end device.

Example response

{
    "device": {
        "id": "1398f13d-f24d-4de4-8cd3-5905db1d6d9f",
        "name": "device",
        "access_protocol": "",
        "project_id": "05e1aef9040010e22fccc009adecb056",
        "description": "new description",
        "created_at": "2020-09-23T02:00:22.858736Z",
        "updated_at": "2020-09-23T02:12:46Z",
        "access_config": {},
        "attributes": {
            "username": {
                "value": "test-new",
                "optional": true,
                "metadata": {
                    "type": "string"
                }
            }
        },
        "connection_type": "edge"
    }
}

Error Codes

For details, see Error Codes.