Call this operation to create tags for a specified device.
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
Action | String | Yes | The operation that you want to perform. Set the value to SaveDeviceProp. |
ProductKey | String | No | The product key of the device for which you want to create tags.
Note If you use this parameter,
DeviceName is required.
|
DeviceName | String | No | The name of the device for which you want to create tags.
Note If you specify this parameter, you must also specify
ProductKey.
|
IotId | String | No | The unique identifier of the device for which you want to create tags.
Note If you use this parameter,
ProductKey and
DeviceName are not required.
IotId is a globally unique identifier of a device, and corresponds to a combination of
ProductKey and
DeviceName. If you specify both
IotId and the combination of
ProductKey and
DeviceName, the system follows
IotId.
|
Props | String | Yes | Tags to be created. For more information about the structure of a device tag, see the following table Prop.
Note
|
Common request parameters | - | Yes | See Common parameters. |
Parameter | Type | Required | Description |
---|---|---|---|
key | String | Yes | Tag key, which can contain English letters, numbers and dots (.) and must be 2 to 32 characters in length. If the specified tag key is the key of an existing tag of the device, the new tag value overwrites the existing value. If the specified tag key is a new tag key, a new tag will be created. |
value | Object | Yes | Tag value, which can contain Chinese characters, English letters, numbers, hyphens (-), underscores (_), and dots (.), and cannot exceed 128 characters. A Chinese character is counted as two characters. |
Response parameters
Parameter | Type | Description |
---|---|---|
RequestId | String | The globally unique ID generated by Alibaba Cloud for the request. |
Success | Boolean | Indicates whether the call is successful. A value of true indicates that the call is successful. A value of false indicates that the call failed. |
ErrorMessage | String | The error message returned when the call fails. |
Code | String | The error code returned when the call fails. For more information on error codes, see Error codes. |
Examples
Request example
https://iot.cn-shanghai.aliyuncs.com/?Action=SaveDeviceProp
&ProductKey=al**********
&DeviceName=device1
&Props=%7B%22color%22%3A%22red%22%7D
&Common request parameters
Response example
-
JSON format
{ "RequestId":"57b144cf-09fc-4916-a272-a62902d5b207", "Success": true }
-
XML format
<? xml version='1.0' encoding='utf-8'? > <SaveDevicePropResponse> <RequestId>57b144cf-09fc-4916-a272-a62902d5b207</RequestId> <Success>true</Success> </SaveDevicePropResponse>