更新时间:2022-12-05 GMT+08:00

更新终端设备

功能介绍

该API用于更新一个终端设备。

URI

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

表1 Path参数

参数

是否必选

描述

project_id

项目ID,获取方法请参见获取项目ID

device_id

设备ID

请求消息

请求参数

表2 请求Header参数

参数

是否必选

类型

描述

Content-Type

String

消息体的类型(格式)

推荐您使用默认值application/json。

X-Auth-Token

String

用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

表3 请求Body参数

名称

是否必选

参数类型

说明

device

表4 object

终端设备信息

表4 device

参数

是否必选

类型

描述

description

String

终端设备描述,最大长度255,不允许^ ~ # $ % & * < > ( ) [ ] { } ' " \

attributes

Object

终端设备静态属性,最多64个键值。

key为属性名称,value格式请参见表6,示例如下。

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

请求示例

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

响应消息

响应参数

表5 响应Body参数

参数

类型

描述

device

表6 object

终端设备详细信息

响应示例

{
    "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"
    }
}

错误码

请参见错误码