Specifies values for multiple device properties at a time.

Usage notes

If the TSL data is of the float or double type, the parameter values that correspond to the TSL data contain at least one decimal place. Examples: 10.0 and 11.1.

QPS limits

You can call this API operation up to 10 times per second per account.

Note The RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesSetDevicesProperty

The operation that you want to perform. Set the value to SetDevicesProperty.

DeviceName.NRepeatListYeslight

The names of the devices whose properties you want to configure. Valid values: 1 to 100.

ItemsStringYes{"Switch":1,"Color":"blue"}

The properties that you want to configure. The properties must be in the JSON format.

Each property consists of a combination of a property identifier and a property value in the key:value format. Separate multiple properties with commas (,).

For example, you can configure the following properties for a smart lamp:

  • A switch property whose key is Switch and data type is BOOLEAN. The value is 1. The value 1 indicates that the light is on.
  • A color property whose key is Color and whose data type is STRING. The value is blue.

In this case, you can configure the following properties in the JSON format:

Items={"Switch":1,"Color":"blue"}
Note If you configure properties for the custom module testFb, specify Items={"testFb:Switch":1,"testFb:Color":"blue"}. The testFb module is not the default module.
ProductKeyStringYesa1BwAGV****

The ProductKey of the product to which the device belongs.

IotInstanceIdStringNoiot_instc_pu****_c*-v64********

The ID of the instance. You can view the ID of the instance on the Overview page in the IoT Platform console.

Important
  • If your instance has an ID, you must specify the ID for this parameter. Otherwise, the call fails.
  • If no Overview page or ID is generated for your instance, you do not need to configure this parameter.

For more information, see Overview.

QosIntegerNo1

The quality of service (QoS) level of the message. Valid values:

  • 0 (default): The system sends the message at most once.
  • 1: The system sends the message at least once. If a PUBACK response is not returned after you publish a QoS 1 message, the message is resent to the device when the device reconnects to IoT Platform.

In addition to the preceding operation-specific request parameters, you must configure common request parameters when you call this operation. For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeExampleDescription
CodeStringiot.system.SystemException

The error code that is returned if the call fails. For more information, see Error codes.

ErrorMessageStringA system exception occurred.

The error message returned if the call fails.

RequestIdStringE55E50B7-40EE-4B6B-8BBE-D3ED55CCF565

The ID of the request.

SuccessBooleantrue

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=SetDevicesProperty
&DeviceName.1=1102andriod02
&DeviceName.2=1102android01
&Items=%7B%20%20%20%20%20%22Data%22%3A%221372060916%22%2C%20%20%20%20%20%22Status%22%3A1%20%7D
&ProductKey=a1hWjHD****
&<Common request parameters>

Sample success responses

XML format

<SetDevicesPropertyResponse>
  <RequestId>2E19BDAF-0FD0-4608-9F41-82D230CFEE38</RequestId>
  <Success>true</Success>
</SetDevicesPropertyResponse>

JSON format

{
  "RequestId": "2E19BDAF-0FD0-4608-9F41-82D230CFEE38",
  "Success": true
}

Error codes

For a list of error codes, see Service error codes.