Call this operation to view the status of a specified device.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to GetDeviceStatus.
IotId String No

The unique identifier of the device whose status you want to query.

Note If you use this parameter, ProductKey and DeviceName are not required. IotId is a globally unique identifier (GUID) of a device, and corresponds to the combination of ProductKey and DeviceName. If you specify both IotId and the combination of ProductKey and DeviceName, the system follows IotId.
ProductKey String No

The unique identifier of the product to which the device you want to query belongs.

Note If you use this parameter, DeviceName is required.
DeviceName String No

The name of the device.

Note If you use this parameter, ProductKey is required.
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 has 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.
Data Data The device status returned when the call is successful. For more information, see the following table DeviceStatusInfo.
Table 1. DeviceStatusInfo
Parameter Type Description
Status String

Device status. Values:

ONLINE: The device is online.

OFFLINE: The device is offline.

UNACTIVE: The device is not activated.

DISABLE: The device is disabled.

Examples

Request example

https://iot.cn-shanghai.aliyuncs.com/?Action=GetDeviceStatus
 &IotId=MpEKNuEUJzIORNANAWJX0010929900*****
 &Public Request Parameters

Response example

  • JSON format

    {
      "RequestId":"57b144cf-09fc-4916-a272-a62902d5b207",
      "Success": true
      "Data": {
        "Status": "UNACTIVE"
      } 
    }
  • XML format

    <? xml version='1.0' encoding='utf-8'? >
    <GetDeviceStatusResponse>
        <RequestId>57b144cf-09fc-4916-a272-a62902d5b207</RequestId>
        <Success>true</Success>
        <Data>
            <Status>UNACTIVE</Status>
        </Data>
    </GetDeviceStatusResponse>