Call this operation to query device statistics of a specified product.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to QueryDeviceStatistics.
ProductKey String No The unique identifier of the product.
  • If you specify this parameter, IoT platform will return the device statistics of the specified product.
  • If you do not specify this parameter, IoT Platform will return the device statistics of this account.
Common Request Parameters - Yes 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 statistics of the specified product returned when the call is successful. For more information, see the following table StatisticsInfo.
Table 1. StatisticsInfo
Parameter Type Description
DeviceCount Integer The total number of devices.
OnlineCount Integer The number of online devices.
ActiveCount Integer The number of activated devices.

Examples

Request example

https://iot.cn-shanghai.aliyuncs.com/?Action=QueryDeviceStatistics
&ProductKey=al**********
&Public Request Parameters

Response example

  • JSON format

    {
      "RequestId":"57b144cf-09fc-4916-a272-a62902d5b207",
      "Success": true,
      "Data": {
        "DeviceCount": 100,
        "OnlineCount": 10,
        "ActiveCount": 50
      }
    }
    
  • XML format

    <? xml version='1.0' encoding='utf-8'? >
    <QueryDeviceStatisticsResponse>
        <RequestId>57b144cf-09fc-4916-a272-a62902d5b207</RequestId>
        <Success>true</Success>
        <Data>
            <DeviceCount>100</DeviceCount>
            <OnlineCount>10</OnlineCount>
            <ActiveCount>50</ActiveCount>
        </Data>
    </QueryDeviceStatisticsResponse>