Creates multiple custom device names under a specified product. IoT Platform checks the validity of these names.
API usage
You must use this operation with the BatchRegisterDeviceWithApplyId operation to register multiple devices with custom names under a product.
Procedure:
1. Call the BatchCheckDeviceNames operation to specify the names of the devices to be registered. IoT Platform returns the ApplyId parameter. If the call is successful, a request to verify the device names is submitted. IoT Platform asynchronously verifies the device names.
2. Call the QueryBatchRegisterDeviceStatus operation to query the name setting result.
3. Call the BatchRegisterDeviceWithApplyId operation to register the devices.
4. Optional. Call the QueryBatchRegisterDeviceStatus operation to query the device registration result.
5. Call the QueryPageByApplyId operation to query the information of the registered devices.
Limits
- You can specify up to 1,000 device names 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 | BatchCheckDeviceNames |
The operation that you want to perform. Set the value to BatchCheckDeviceNames. |
ProductKey | String | Yes | a1BwAGV**** |
The ProductKey of the product to which the device belongs. |
IotInstanceId | String | No | iot-cn-0pp1n8t**** |
The ID of the instance. This parameter is not required for public instances. However, the parameter is required for the instances that you have purchased. |
DeviceName.N | RepeatList | No | light |
The name of the device. The device name must be unique within the product. Each device name must be 4 to 32 characters in length and can contain letters, digits, hyphens (-), underscores (_), periods (.), at signs (@), and colons (:). You must specify this parameter or the DeviceNameList.N.DeviceName parameter. If you specify this parameter and the DeviceNameList.N.DeviceName parameter at the same time, the DeviceNameList.N.DeviceName parameter is used by default. Note You can specify up to 1,000 device names in a single call.
|
DeviceNameList.N.DeviceName | String | No | light1 |
The name of the device. The device name must be unique within the product. Each device name must be 4 to 32 characters in length and can contain letters, digits, hyphens (-), underscores (_), periods (.), at signs (@), and colons (:). You must specify this parameter or the DeviceName.N parameter. If you specify this parameter and the DeviceName.N parameter at the same time, this parameter is used by default. Note You can specify up to 1,000 device names in a single call.
|
DeviceNameList.N.DeviceNickname | String | No | Smart light 1 |
The alias of the device. Each alias must be 4 to 64 characters in length and can contain letters, digits, and underscores (_). If this parameter is specified, you must specify the DeviceNameList.N.DeviceName parameter. |
In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this API operation. For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | iot.system.SystemException |
The error code returned if the call fails. For more information about error codes, see Error codes. |
Data | Struct |
The returned data. |
|
ApplyId | Long | 1295006 |
The application ID returned if the call is successful. When you call the BatchRegisterDeviceWithApplyId operation to register the devices, this parameter is required. |
InvalidDeviceNameList | List | { "InvalidDeviceName": [ "APT$", "aw" ] } |
The list of invalid device names returned if the call fails. |
InvalidDeviceNicknameList | List | { "InvalidDeviceNickname": [ "APT$", "aw" ] } |
The list of invalid device aliases returned if the call fails. |
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=BatchCheckDeviceNames
&productKey=a1BwAGV****
&DeviceNameList.1.DeviceName=light1
&DeviceNameList.2.DeviceName=light2
&DeviceNameList.3.DeviceName=light3
&DeviceNameList.3.DeviceNickname=smart light 3
&<Common request parameters>
Sample success responses
XML
format
<BatchCheckDeviceNamesResponse>
<Data>
<ApplyId>1234567</ApplyId>
</Data>
<RequestId>E976E36B-6874-4FA4-8BC0-55F9BEC5E2EF</RequestId>
<Success>true</Success>
<BatchCheckDeviceNamesResponse>
JSON
format
{
"Data": {
"ApplyId": 1234567
},
"RequestId": "E976E36B-6874-4FA4-8BC0-55F9BEC5E2EF",
"Success": true
}
Error codes
For a list of error codes, visit the API Error Center.