Registering an Edge Device
Function
This API is used to register an edge device.
URI
POST /v2/{project_id}/edgemgr/devices
| Parameter | Mandatory | Description |
|---|---|---|
| project_id | Yes | Project ID. For details about how to obtain a project ID, see Obtaining a Project ID. |
Request
Request parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| device | Yes | Table 3 object | Device information. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | No | String | Edge device ID. Enter 24 to 64 characters starting with a letter or digit. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
| name | Yes | String | Edge device name. The value contains a maximum of 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
| description | No | String | Edge device description. The value contains a maximum of 255 characters. The following characters are not allowed: ^~#$%&*<>()[]{}'"\ |
| attributes | No | Object | Static properties of an edge 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"
}
}
} |
| connection_type | No | String | Connection type. The default value is edge. |
| access_protocol | Yes | String | Access protocol. The options are as follows:
|
| twin | No | Object | Dynamic properties of an edge 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 7. The following is an example: "twin": {
"devicestate": {
"optional": true,
"expected": {
"value": "running"
},
"metadata": {
"type": "string"
}
}
} |
| access_config | No | Table 24 object | Access configuration, which varies depending on access_protocol. |
| property_visitors | No | Object | Twin property configuration. The key must be the same as that of the corresponding twin property. For details about the value format, see Table 25. |
Request example:
{
"device": {
"access_protocol": "userdefine",
"name": "device",
"connection_type": "edge",
"description": "",
"attributes": {}
}
} Response
| Parameter | Type | Description |
|---|---|---|
| device | Edge device details. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Edge device ID. |
| name | String | Edge device name. |
| access_protocol | String | Access protocol. |
| description | String | Edge device description. |
| project_id | String | Project ID. |
| created_at | String | Time when the edge device is created. |
| updated_at | String | Time when the edge device is updated. |
| attributes | Object | Static properties of the edge 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"
}
}
} |
| twin | Object | Dynamic properties of an edge 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 21. The following is an example: "devicestate":{
"expected":{
"value":"running",
"metadata":{
"timestamp":1536822119463
}
},
"optional":true,
"metadata":{ "type":"string" }
} |
| access_config | Table 24 object | Access configuration, which varies depending on access_protocol. |
| property_visitors | Object | Twin property configuration, which varies depending on access_protocol. The key indicates the property name. For details about the format of value, see Table 25. |
| connection_type | String | Connection type. The default value is edge. |
Response example:
{
"device": {
"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"
}
} Error Codes
For details, see Error Codes.
Last Article: Edge Device Management
Next Article: Updating an Edge Device
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.