Call this operation to query the status of multiple specified devices in a product.
Limits
You can query the status of up to 50 specified devices in a single call.
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
Action | String | Yes | The operation that you want to perform. Set the value to BatchGetDeviceState. |
ProductKey | String | No |
The ProductKey of the devices whose status you want to query. Note If you use this parameter, DeviceName is required.
|
DeviceName | List<String> | No |
The names of the devices whose status you want to query. Note
|
IotIds | List | No |
The unique identifiers of the devices whose status you want to query. Note If you specify this parameter, ProductKey and DeviceName are not required. IotId is a globally unique identifier of a device, and corresponds to a combination of
ProductKey and DeviceName. If you specify both IotId and the combination of ProductKey and DeviceName, the system follows IotId.
|
Common request parameters | - | Yes | For more information about common request parameters, see Common parameters. |
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 failed. |
ErrorMessage | String | The error message returned when the call fails. |
Code | String | The error code returned when the call fails. For more information about error codes, see Error codes. |
DeviceStatusList | List | The status of the specified devices returned when the call is successful. For more information, see the following table DeviceStatus. |
Parameter | Type | Description |
---|---|---|
DeviceName | String | Device name. |
Status | String |
Device status. Values include: ONLINE OFFLINE UNACTIVE DISABLE |
DeviceId | String |
The device ID (only available for the old edition of IoT Platform). Note This parameter is deprecated. Do not use this to identify a device. Currently, the
valid device identifiers are IotId and the combination of ProductKey and DeviceName.
|
IotId | String | The unique identifiers of the device issued by IoT Platform. |
Examples
Request example
https://iot.cn-shanghai.aliyuncs.com/?Action=BatchGetDeviceState
&productKey=al*********
&DeviceName. 1=device1
&DeviceName. 2=device2
&Common request parameters
Response example
-
JSON format
{ "DeviceStatusList": { "DeviceStatus": [ { "Status": "UNACTIVE", "DeviceId": "xHkR9exGvarIjZ******", "DeviceName": "device1", "IotId": "xHkR9exGvarIjZzpZ0H******" }, { "Status": "UNACTIVE", "DeviceId": "YXMl37sPvABrJy******", "DeviceName": "device2", "IotId": "YXMl37sPvABrJyqoKP******" } ] }, "RequestId": "D9E3DADE-5B9D-4594-AE0E-8090C16B485D", "Success": true }
-
XML format
<? xml version="1.0" encoding="UTF-8" ? > <BatchGetDeviceStateResponse> <DeviceStatusList> <DeviceStatus> <Status>UNACTIVE</Status> <DeviceId>xHkR9exGvarIjZz******</DeviceId> <DeviceName>device1</DeviceName> <IotId>xHkR9exGvarIjZzpZ0HW******</IotId> </DeviceStatus> <DeviceStatus> <Status>UNACTIVE</Status> <DeviceId>YXMl37sPvABrJy******</DeviceId> <DeviceName>device2</DeviceName> <IotId>YXMl37sPvABrJyqoKP2o******</IotId> </DeviceStatus> </DeviceStatusList> <RequestId>D9E3DADE-5B9D-4594-AE0E-8090C16B485D</RequestId> <Success>true</Success> </BatchGetDeviceStateResponse>