Adds multiple devices to a cloud gateway product at a time.
Usage notes
The BatchImportVehicleDevice operation is suitable for scenarios in which you want to add multiple devices to a JT/T 808 or GB/T 32960 cloud gateway product at a time.
QPS limits
You can call this API operation up to 10 times per second per account.
Debugging
Request parameters
Parameter |
Type |
Required |
Example |
Description |
Action | String | Yes | BatchImportVehicleDevice | The operation that you want to perform. Set the value to BatchImportVehicleDevice. |
IotInstanceId | String | Yes | iot-1n8t**** | The ID of the instance. You can view the ID of the instance on the Overview tab in the IoT Platform console. For more information, see Overview. |
ProductKey | String | Yes | a1Bw**** | The ProductKey of the product to which the device belongs. |
DeviceList.N.Manufacturer | String | No | mf0001 | The manufacturer ID of the device. If you want to add a JT/T 808 cloud gateway device, this parameter is required. The manufacturer ID must be 4 to 11 characters in length, and can contain letters, digits, and hyphens (-). Note You can specify up to 10,000 device manufacturer IDs in a single call. If the number of device manufacturer IDs exceeds the limit, excess device manufacturer IDs are discarded. |
DeviceList.N.DeviceModel | String | No | dm0001 | The device model of the device. If you want to add a JT/T 808 cloud gateway device, this parameter is required. The device model must be 4 to 30 characters in length, and can contain letters, digits, and hyphens (-). Note You can specify up to 10,000 device models in a single call. If the number of device models exceeds the limit, excess device models are discarded. |
DeviceList.N.DeviceId | String | No | di0001 | The ID of the device. If you want to add a JT/T 808 cloud gateway device, this parameter is required. The ID must be 4 to 30 characters, and can contain letters, digits, and hyphens (-). Note You can specify up to 10,000 device IDs in a single call. If the number of device IDs exceeds the limit, excess device IDs are discarded. |
DeviceList.N.DeviceName | String | No | vin0001 | The DeviceName of the device. If you want to add a JT/T 808 cloud gateway device, you must specify the vehicle identification number (VIN) of the device as the value of this parameter. The DeviceName must be 4 to 17 characters in length, and can contain letters and digits. Note You can specify up to 10,000 DeviceNames in a single call. If the number of DeviceNames exceeds the limit, excess DeviceNames are discarded. |
In addition to the preceding operation-specific request parameters, you must configure common request parameters when you call this 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, see the "Error codes" section of this topic. |
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. |
InvalidDetailList | Array of InvalidDetailList | The details of invalid devices returned if the call fails. |
|
InvalidDetailList | |||
DeviceId | String | di_*0001 | The IDs of JT/T 808 cloud gateway devices. |
DeviceModel | String | dm_*0001 | The device models of JT/T 808 cloud gateway devices. |
DeviceName | String | device_*0001 | The DeviceNames of GB/T 32960 cloud gateway devices. |
ErrorMsg | String | The device name is illegal. | The error message returned if the call fails. |
Manufacturer | String | mf_*0001 | The manufacturer IDs of JT/T 808 cloud gateway devices. |
InvalidDeviceIdList | List | { "InvalidDeviceIdList": [ "di&^", "&*G%" ] } | The invalid device IDs returned if JT/T 808 cloud gateway devices failed to be added. |
InvalidDeviceModelList | List | { "InvalidDeviceModelList": [ "dm$", "dm_uh" ] } | The invalid device models returned if JT/T 808 cloud gateway devices failed to be added. |
InvalidDeviceNameList | List | { "InvalidDeviceNameList": [ "APT$", "aw" ] } | The invalid DeviceNames returned if GB/T 32960 cloud gateway devices failed to be added. |
InvalidManufacturerList | List | { "InvalidManufacturerList": [ "bm*$", "#$F" ] } | The invalid device manufacturer IDs returned if JT/T 808 cloud gateway devices failed to be added. |
RepeatedDeviceIdList | List | { "RepeatedDeviceIdList": [ "^67$", "1" ] } | The duplicate device IDs returned if JT/T 808 cloud gateway devices failed to be added. |
RepeatedDeviceNameList | List | { "RepeatedDeviceNameList": [ "abcd", "asdf" ] } | The duplicate DeviceNames returned if GB/T 32960 cloud gateway devices failed to be added. |
ErrorMessage | String | A system exception occurred. | The error message returned if the call fails. |
RequestId | String | E4C0FF92-2A86-41DB-92D3-73B60310D25E | The ID of the request. |
Success | Boolean | true | Indicates whether the call was successful. Valid values:
|
Examples
Sample requests
http(s)://iot.cn-shanghai.aliyuncs.com/?Action=BatchImportVehicleDevice
&DeviceList.1.DeviceModel=dm0001
&DeviceList.1.Manufacturer=mf0001
&DeviceList.1.DeviceId=di0001
&ProductKey=a1Bw****
&IotInstanceId=iot-cv3********
&<Common request parameters>
Sample success responses
XML
format
<BatchImportVehicleDeviceResponse>
<RequestId>E4C0FF92-2A86-41DB-92D3-73B60310D25E</RequestId>
<Data>
<ApplyId>1295006</ApplyId>
</Data>
<Code></Code>
<Success>true</Success>
</BatchImportVehicleDeviceResponse>
JSON
format
{
"RequestId": "E4C0FF92-2A86-41DB-92D3-73B60310D25E",
"Data": {
"ApplyId": 1295006
},
"Code": "",
"Success": true
}
Error codes
HttpCode |
Error Code |
Error message |
Description |
400 | iot.device.TooManyDeviceNamesPerRequest | The devices you query exceed the maximum number. | The number of DeviceNames that you specified in the request exceeds the limit. |
400 | iot.device.ApplyManyDevicesFailed | An error occurred while creating multiple devices. | The request to create multiple devices at a time failed. |
400 | iot.common.InvalidTenant | the device tenantId is invalid. | The tenant information of the device is invalid. |
400 | iot.device.InvalidFormattedDeviceNameInNameArray | The DeviceName list contains an invalid DeviceName. | An invalid DeviceName exists in the DeviceName list. |
400 | iot.prod.InvalidProductAuthType | The product authentication type is invalid. | The product certification type is invalid. |
400 | iot.prod.InvalidFormattedProductkey | The ProductKey format is invalid. | The format of the value of the ProductKey parameter is invalid. |
For a list of error codes, see Service error codes.