You can call this operation to query all the devices of a specified product.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to QueryDevice.
ProductKey String Yes The unique identifier of the product.
PageSize Integer   No The number of devices per page in the response. The maximum limit is 50. The default value is 10.
CurrentPage Integer   No Specify which page of the returned results you want the system to display. The default value is 1.
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.
PageCount Integer The total page number.
PageSize Integer   The number of devices displayed per page.
Page Integer The current page number.
Total Integer The total number of devices.
Data Data The list of device information returned when the call is successful. See the following table DeviceInfo.
Note The device information is listed in reverse chronological order.
Table 1. DeviceInfo
Parameter Type Description
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.
DeviceName String The device name.
ProductKey String The unique identifier of the product.
DeviceSecret String The device key.
GmtCreate String The GMT time when the device was created.
GmtModified String The GMT time when the device information was modified.
UtcCreate String The UTC time when the device was created.
UtcModified String The UTC time when the device information was modified.
DeviceStatus String Device status.
IotId String The unique identifier issued by IoT Platform to the device.
Nickname String The nickname of the device.

Examples

Request example

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

Response example

  • 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
    }
  • XML format

    <?xml version="1.0" encoding="UTF-8" ?>
    <QueryDeviceResponse>
        <PageCount>1</PageCount>
        <Data>
            <DeviceInfo>
                <DeviceId>VIjUsKaJsdWqt6nl****</DeviceId>
                <DeviceName>led_device</DeviceName>
                <ProductKey>a1dafDE****</ProductKey>
                <DeviceSecret>qQP6xARs7ky1HuM2reh7y6M4BTdfe****</DeviceSecret>
                <UtcModified>2019-02-19T10:20:14.000Z</UtcModified>
                <GmtCreate>Wed, 30-Jan-2019 11:32:39 GMT</GmtCreate>
                <UtcCreate>2019-01-30T11:32:39.000Z</UtcCreate>
                <GmtModified>Tue, 19-Feb-2019 10:20:14 GMT</GmtModified>
                <DeviceStatus>OFFLINE</DeviceStatus>
                <IotId>nadRfljdEndlfadgadfse****</IotId>
                <Nickname>SensorInShanghai</Nickname>
            </DeviceInfo>
            <DeviceInfo>
                <DeviceId>QwTxRbhFwcaJBad****</DeviceId>
                <DeviceName>led_driver</DeviceName>
                <ProductKey>a1dafDE****</ProductKey>
                <DeviceSecret>6ahkx2cOd0kVPsjnVmxYaGEhMfdf****</DeviceSecret>
                <UtcModified>2019-01-30T11:10:10.000Z</UtcModified>
                <GmtCreate>Wed, 30-Jan-2019 11:10:10 GMT</GmtCreate>
                <UtcCreate>2019-01-30T11:10:10.000Z</UtcCreate>
                <GmtModified>Wed, 30-Jan-2019 11:10:10 GMT</GmtModified>
                <DeviceStatus>UNACTIVE</DeviceStatus>
                <IotId>nadddfRddfaEEadfed****</IotId>
                <Nickname>DriverInShanghai</Nickname>
            </DeviceInfo>
        </Data>
        <PageSize>10</PageSize>
        <RequestId>A4F5820D-E2B3-48D4-AAF8-53FF6A319E27</RequestId>
        <Success>true</Success>
        <Total>2</Total>
    </QueryDeviceResponse>