Registers multiple devices under a product. The DeviceNames of these devices are randomly generated.
You can use one of the following methods to register multiple devices:
If you want to generate random DeviceNames, call the BatchRegisterDevice operation.
Perform the following steps to register devices and view the result:
Call the BatchRegisterDevice operation to register multiple devices. A successful response indicates that the registration request is submitted. The actual registration process is asynchronously implemented and takes some minutes.
Call the [QueryBatchRegisterDeviceStatus] operation to query the device registration result.
Call the [QueryPageByApplyId] operation to view the details of registered devices. The details include the DeviceName, DeviceSecret, and IotId parameters.
If you want to specify custom DeviceNames, call the BatchRegisterDeviceWithApplyId operation. For more information, see [BatchRegisterDeviceWithApplyId].
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | BatchRegisterDevice | The operation that you want to perform. Set the value to BatchRegisterDevice. |
| Count | Integer | Yes | 100 | The number of devices to be registered. Note You can register up to 10,000 devices in a single call. |
| ProductKey | String | Yes | a1BwAGV**** | The ProductKey of the product to which the devices belong. |
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.
| Parameter | Type | Example | Description |
|---|---|---|---|
| Code | String | iot.system.SystemException | The error code returned if the call fails. For more information, see Error codes. |
| Data | Struct | The data returned if the call is successful. | |
| ApplyId | Long | 1295006 | The application ID (ApplyId) returned for the request if the call is successful. |
| 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. |
Sample requests
https://iot.cn-shanghai.aliyuncs.com/?Action=BatchRegisterDevice
&ProductKey=a1BwAGV****
&Count=10
&<Common request parameters>
Sample success responses
XML format
<BatchRegisterDeviceResponse>
<Data>
<ApplyId>12345678</ApplyId>
</Data>
<RequestId>92C67DC1-41B5-45F8-9AFD-1FB42448D405</RequestId>
<Success>true</Success>
</BatchRegisterDeviceResponse>
JSON format
{
"Data": {
"ApplyId": 12345678
},
"RequestId": "92C67DC1-41B5-45F8-9AFD-1FB42448D405",
"Success": true
}