Call this operation to add devices to a group.
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
Action | String | Yes | The action that you want to perform. Set the value to BatchAddDeviceGroupRelations. |
GroupId | String | Yes | The group ID that is the unique identifier of the group. |
Devices | List<Device> | Yes | The devices that you want to add to the group. See the following table for device parameters. |
Common request parameters | - | Yes | see Common parameters. |
Parameter | Type | Required | Description |
---|---|---|---|
ProductKey | String | Yes | The product key of the device. |
DeviceName | String | Yes | The name of the device. |
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 has failed. |
ErrorMessage | String | The result message. |
Code | String | For error codes, see Error codes. |
ValidDeviceCount | Integer | The number of valid devices that are listed in the request. |
SuccessAddedDeviceCount | Integer | The number of devices that have been added to the group by this operation. |
ExceedMaxGroupDeviceCount | Integer | The number of devices that have been added to ten or more groups. (Currently, a device can be added to up to ten groups.) |
AlreadyRelatedGroupDeviceCount | Integer | The number of devices in the group before this operation. |
Example
Request example
http://iot.cn-shanghai.aliyuncs.com/?Action=BatchAddDeviceGroupRelations
&Device. 1. DeviceName=ZHuPo6sZzv7pOzYhv31y
&Device. 1. ProductKey=a1kORrKiwQj
&Device. 2. DeviceName=rB4V9PDW2FCPmwuf2N3Y
&Device. 2. ProductKey=a1kORrKiwQj
&GroupId=6VfhebLg5iUerXep
&Common request parameters
Response example
{
"SuccessAddedDeviceCount":2,
"ExceedTenGroupDeviceCount":0,
"ErrorMessage":"2 devices have been added, and 0 devices failed to be added.",
"ValidDeviceCount":2,
"AlreadyRelatedGroupDeviceCount":0,
"RequestId":"671D0F8F-FDC7-4B12-93FA-336C079C965A",
"Success":true
}