Registers multiple devices under a product. The DeviceNames of these devices are randomly generated.
Usage notes
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:
1. 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.
2. Call the QueryBatchRegisterDeviceStatus operation to query the device registration result.
3. 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.
Limits
- You can create a maximum of 10,000 devices in a single call.
-
Each Alibaba Cloud account can run a maximum of 10 queries per second (QPS).Note RAM users of an Alibaba Cloud account share the quota of the account.
Debugging
Request parameters
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. |
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
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. |
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.
|
Examples
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
}
Error codes
For a list of error codes, visit the API Error Center.