Call this operation to batch set the desired attribute values for the specified device.
Read-only properties do not support setting the desired property value.
Up to 10 desired property values can be set in one call.
After the device is created, the version of the expected property value ( Version ) 0 . When you first set the desired property value, if you specify Version parameter, you specify Version value is 0 .
| Name | Type | Required | Sample Values | description |
|---|---|---|---|---|
| Action | String | Yes | SetDeviceDesiredProperty | System defined parameters. Value: SetDeviceDesiredProperty. |
| Items | String | Yes | {"Temperature":35} | The desired property value to set, consisting of the property’s Key:Value the data format is JSON String, for example {"Temperature":35} . You can enter up to 10 desired attribute values. Key the value is the identifier of the property ( identifier ). In the console, function Definition view; |
| Versions | String | Yes | {"Temperature":2} | The current version of the expected attribute Value, consisting of Key:Value, and the data format is JSON String, for example, {"Temperature":2}. |
| IotInstanceID | String | No | Si ******** | The instance ID. In the IoT Platform console, you can service Instance Details Page to view the current instance’s ID |
| IoTID | String | No | **** 00100 | The ID of the device to set the desired property value. The ID issued by IoT platform for the device. The unique identifier of the device. |
| DeviceName | String | No | Light | The name of the device to set the desired property value. |
| ProductKey | String | No | A1BwAGV * * * * | The ProductKey of the product that the device for which you want to set the desired property value belongs. |
| Expiration | Long | No | 60 | Effective time. How long after the setting expires unit: Seconds |
Note: When calling an API, in addition to the API-specific request parameters described in this topic, you must also pass in the common request parameters. For more information about common request parameters, see Common parameters.
| Name | Type | Sample Values | Description |
|---|---|---|---|
| Code | String | Iot.system.SystemException | The error code returned when the call fails. For more information, see Error codes. |
| Data | Struct | The data returned when the call is successful. For details, see the following parameters. | |
| MessageID | String | 300511751 | The ID of the message sent by cloud to the device to set the desired attribute value. |
| Versions | String | {"Temperature":2} | The current version number of the expected attribute value after the expected attribute value is set this time. |
| ErrorMessage | String | System Exception | Error information returned when the call fails. |
| RequestID | String | E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565 | The unique identifier generated by the request. |
| Success | Boolean | True | Whether the call was successful. - True : The call succeeded. - False : The call failed |
curl 'https://si-d6e******48958054.tuyacloud.com:8686/?Action=SetDeviceDesiredProperty&Versions=%7B%22rain%22%3A3%7D&SignatureNonce=d9d8ec362be94685a5d9162440069971&IotInstanceId=iot-06z00j616bccotp&AccessKeyId=xMr9wgwXQLhv****Ua65o03mcD&SignatureMethod=HMAC-SHA1&Items=%7B%22rain%22%3A13%7D&Timestamp=2024-11-17T15%3A46%3A48Z&ProductKey=k1ymv1DuLfE&DeviceName=a53b1fa6490e&Signature=wG60ouULKZUq%2Bjcgi%2BCZZyEef3A%3D'
{
"Data": {
"MessageId": "300511751",
"Versions": "{\"LightAdjustLeve\":2}"
},
"RequestId": "AADE79D2-B328-4FC6-A3E0-34BB23BCA440",
"Success": true
}