Queries all the devices of a product.

Limits

  • Each Alibaba Cloud account can run a maximum of 50 queries per second (QPS).
    Note RAM users of an Alibaba Cloud account share the quota of the account.
  • When the value of the CurrentPage parameter multiplied by the value of the PageSize parameter equals a value greater than or equal to 100000, the QPS of this operation decreases.

    In this case, each Alibaba Cloud account can run a maximum of 2 QPS.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes QueryDevice

The operation that you want to perform. Set the value to QueryDevice.

ProductKey String Yes a1BwAGV****

The key of the product to which the devices belong.

IotInstanceId String No iot_instc_pu****_c*-v64********

The ID of the instance. This parameter is not required for the public instance but required for Enterprise Edition instances.

PageSize Integer No 10

The number of entries to return on each page. Valid values: 1 to 50. Default value: 10.

CurrentPage Integer No 1

The number of the page to return. Default value: 1.

In addition to the preceding operation-specific request parameters, you must specify 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 Error codes.

Data Array of DeviceInfo

The list of device information returned if the call is successful.

Note The returned device information is sorted in reverse chronological order based on the time when the devices were created.
DeviceInfo
DeviceId String dwnS41bhNxjslDAI****

The ID of the device. This parameter is used in earlier versions.

Note This parameter is no longer used. Do not use this parameter to identify a device. You can use the IotId parameter or a combination of the ProductKey and DeviceName parameters to identify a device.
DeviceName String light

The name of the device.

DeviceSecret String sLefbFmN9SYfnWLJTePG893XNuRV****

The secret of the device.

DeviceStatus String ONLINE

The status of the device. Valid values:

  • ONLINE: The device is online.
  • OFFLINE: The device is offline.
  • UNACTIVE: The device is not activated.
  • DISABLE: The device is disabled.
DeviceType String Lighting

The category of the product to which the device belongs.

Note This parameter is not returned.
GmtCreate String Wed, 20-Feb-2019 02:16:09 GMT

The time when the device was created. The time is displayed in GMT.

GmtModified String Wed, 20-Feb-2019 02:16:09 GMT

The last time when the device information was updated. The time is displayed in GMT.

IotId String Q7uOhVRdZRRlDnTLv****00100

The ID of the device. The ID is the unique identifier that is issued by IoT Platform to the device.

Nickname String Smart light

The alias of the device.

ProductKey String a1BwAGV****

The key of the product to which the device belongs.

UtcCreate String 2019-02-20T02:16:09.000Z

The time when the device was created. The time is displayed in UTC.

UtcModified String 2019-02-20T02:16:09.000Z

The last time when the device information was updated. The time is displayed in UTC.

ErrorMessage String A system exception occurred.

The error message returned if the call fails.

Page Integer 1

The page number of the returned page.

PageCount Integer 1

The total number of pages returned.

PageSize Integer 10

The number of entries returned per page.

RequestId String E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565

The ID of the request.

Success Boolean true

Indicates whether the call was successful.

  • true: The call was successful.
  • false: The call failed.
Total Integer 2

The total number of devices.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=QueryDevice
&ProductKey=aldafD****
&PageSize=10
&CurrentPage=1
&<Common request parameters>

Sample success responses

XML format

<QueryDeviceResponse>
  <PageCount>1</PageCount>
  <Data>
        <DeviceInfo>
              <DeviceId>Av8NGHGtwPrH9BYG****</DeviceId>
              <DeviceName>Av8NGHGtwPrH9BYGLMBi</DeviceName>
              <ProductKey>a1dafDE****</ProductKey>
              <DeviceSecret>d7GYhf5hfcPHDe1bXSd3n9MjO1G3****</DeviceSecret>
              <UtcModified>2019-02-20T02:16:09.000Z</UtcModified>
              <GmtCreate>Wed, 20-Feb-2019 02:16:09 GMT</GmtCreate>
              <UtcCreate>2019-02-20T02:16:09.000Z</UtcCreate>
              <GmtModified>Wed, 20-Feb-2019 02:16:09 GMT</GmtModified>
              <IotId>Av8NGHGtwPrH9BYGLMBi00****</IotId>
              <DeviceStatus>UNACTIVE</DeviceStatus>
              <Nickname>SensorInShanghai</Nickname>
        </DeviceInfo>
        <DeviceInfo>
              <DeviceId>zNIcSmWQ9BPJlmkj****</DeviceId>
              <DeviceName>zNIcSmWQ9BPJlmkjn3H1</DeviceName>
              <ProductKey>a1dafDE****</ProductKey>
              <DeviceSecret>C27XXmC18yLIEDXvUj6FSlvgO7ag****</DeviceSecret>
              <UtcModified>2019-02-20T02:16:09.000Z</UtcModified>
              <GmtCreate>Wed, 20-Feb-2019 02:16:09 GMT</GmtCreate>
              <UtcCreate>2019-02-20T02:16:09.000Z</UtcCreate>
              <GmtModified>Wed, 20-Feb-2019 02:16:09 GMT</GmtModified>
              <IotId>zNIcSmWQ9BPJlmkjn3H100****</IotId>
              <DeviceStatus>UNACTIVE</DeviceStatus>
              <Nickname>DriverInShanghai</Nickname>
        </DeviceInfo>
  </Data>
  <Page>1</Page>
  <PageSize>10</PageSize>
  <RequestId>CD9E5F99-A095-4A05-9256-D924EA3075E8</RequestId>
  <Success>true</Success>
  <Total>2</Total>
</QueryDeviceResponse>

JSON format

{
  "PageCount": 1, 
  "Data": {
    "DeviceInfo": [
      {
        "DeviceId": "Av8NGHGtwPrH9BYG****", 
        "DeviceName": "Av8NGHGtwPrH9BYGLMBi", 
        "ProductKey": "a1dafDE****", 
        "DeviceSecret": "d7GYhf5hfcPHDe1bXSd3n9MjO1G3****", 
        "UtcModified": "2019-02-20T02:16:09.000Z", 
        "GmtCreate": "Wed, 20-Feb-2019 02:16:09 GMT", 
        "UtcCreate": "2019-02-20T02:16:09.000Z", 
        "GmtModified": "Wed, 20-Feb-2019 02:16:09 GMT", 
        "IotId": "Av8NGHGtwPrH9BYGLMBi00****", 
        "DeviceStatus": "UNACTIVE", 
        "Nickname": "SensorInShanghai"
      }, 
      {
        "DeviceId": "zNIcSmWQ9BPJlmkj****", 
        "DeviceName": "zNIcSmWQ9BPJlmkjn3H1", 
        "ProductKey": "a1dafDE****", 
        "DeviceSecret": "C27XXmC18yLIEDXvUj6FSlvgO7ag****", 
        "UtcModified": "2019-02-20T02:16:09.000Z", 
        "GmtCreate": "Wed, 20-Feb-2019 02:16:09 GMT", 
        "UtcCreate": "2019-02-20T02:16:09.000Z", 
        "GmtModified": "Wed, 20-Feb-2019 02:16:09 GMT", 
        "IotId": "zNIcSmWQ9BPJlmkjn3H100****", 
        "DeviceStatus": "UNACTIVE", 
        "Nickname": "DriverInShanghai"
      }
    ]
  }, 
  "Page": 1, 
  "PageSize": 10, 
  "RequestId": "CD9E5F99-A095-4A05-9256-D924EA3075E8", 
  "Success": true, 
  "Total": 2
}

Error codes

For a list of error codes, visit the API Error Center.