Updating an End Device Template
Function
This API is used to update an end device template.
URI
PUT /v2/{project_id}/edgemgr/device-templates/{device_template_id}
Parameter |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
Project ID. For details about how to obtain a project ID, see Obtaining a Project ID. |
device_template_id |
Yes |
Device template ID. |
Request
Request parameters
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. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
device_template |
Yes |
device_template object |
Device template information. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
description |
No |
String |
Device template description. The description contains a maximum of 255 characters. |
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": { "value": "test", "optional": true, "metadata": { "type": "string" } } |
tags |
No |
Table 9 object |
Device template tag, in key-value pair format. |
access_protocol |
No |
String |
Access protocol. The options are as follows:
|
property_visitors |
No |
Table 25 object |
Twin property configuration, which varies depending on access_protocol. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
excepted |
Yes |
Table 6 object |
Expected information about dynamic properties. |
optional |
No |
Boolean |
Whether the property is optional. The default value is true. The value for properties inherited from a template is false by default. |
metadata |
No |
Table 7 object |
Metadata of dynamic properties. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
value |
Yes |
String |
Initial value of a dynamic property. The value contains a maximum of 512 characters. Only letters, digits, and special characters (_-.,:/@#) are allowed. |
metadata |
No |
Table 8 object |
Time when the expected value is set. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
Yes |
String |
Attribute type ID. Value: string, int, float, or boolean. The type of boolean is true or false. Default value: string. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
timestamp |
No |
String |
Modification time, which is in Unix timestamp format. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
No |
String |
Key of a tag. The key must contain 1 to 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
value |
No |
String |
Value of a tag. The value must contain 0 to 43 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
{ "device_template":{ "description":"This is a camera template", "attributes":{ "cameraURL":{ "value":"127.0.0.1", "metadata":{ "type":"string" } } }, "twin":{ "runstate":{ "expected":{ "value":"running" }, "metadata":{ "type":"string" } } } } }
Response
Response parameters
Parameter |
Type |
Description |
---|---|---|
device_template |
Table 7 object |
Details about the end device template. |
Example response
{ "device_template":{ "name":"CameraTemplate", "description":"This is a camera template", "created_at":"2018-07-16T04:01:21.212072", "updated_at":"2018-07-18T04:01:21.212017", "access_protocol": "userdefine", "project_id":"d16e6eb6cc0d49a0941df2f31285757a", "id":"82952098-ec24-4643-94e6-9989174fce05", "attributes":{ "cameraURL":{ "value":"127.0.0.1", "metadata":{ "type":"string" } }, "twin":{ "runstate":{ "expected":{ "value":"running" }, "metadata":{ "type":"string" } } } } } }
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot