Specifies properties for multiple devices at a time.

QPS limits

The maximum queries per second (QPS) for each Alibaba Cloud account to call this operation is 10.

Note The Resource Access Management (RAM) users of an Alibaba Cloud account share the quota of the Alibaba Cloud 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

Parameter Type Required Example Description
Action String Yes SetDevicesProperty

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

DeviceName.N RepeatList Yes light

The name of device N for which you want to specify properties. Valid values: 1 to 100.

Items String Yes null

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

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

For example, specify the following properties for a smart lamp:

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

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

Items={"Switch":1,"Color":"blue"}
Note If you specify properties for the custom module testFb, set the Items parameter to {"testFb:Switch":1,"testFb:Color":"blue"}. The testFb module is not the default module.
ProductKey String Yes a1BwAGV****

The key of the product to which the devices belong.

IotInstanceId String No iot_instc_pu****_c*-v64********

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

Notice
  • If your instance has an ID, you must configure this parameter. If you do not set this parameter, the call fails.
  • If your instance has no Overview page or ID, you do not need to set this parameter.

For more information, see Overview.

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

Response parameters

Parameter Type Example Description
Code String iot.system.SystemException

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

ErrorMessage String A system exception occurred.

The error message returned if the call fails.

RequestId String E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565

The ID of the request.

Success Boolean true

Indicates whether the call was successful.

  • 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, visit the API Error Center.