# QueryDevice
调用该接口查询指定产品下的设备列表。
# 请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | QueryDevice | 系统规定参数。取值:QueryDevice。 |
| ProductKey | String | 是 | a1BwAGV**** | 要查询的设备所属产品的ProductKey。 |
| IotInstanceId | String | 是 | 70255861902711**** | 实例ID。您可在物联网平台控制台的实例概览页面,查看当前实例的ID。 |
| PageSize | Integer | 否 | 10 | 指定返回结果中每页显示的记录数量,最大值是1000000。默认值是10。 |
| CurrentPage | Integer | 否 | 1 | 指定显示返回结果中的第几页的内容。默认值是 1。 |
# 返回数据
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Code | String | iot.system.SystemException | 调用失败时,返回的错误码。 |
| Data | Array of DeviceInfo | 调用成功时,返回设备信息列表(DeviceInfo)。说明返回的设备信息按照设备创建时间倒序排列。 | |
| DeviceInfo | |||
| DeviceName | String | light | 设备名称。 |
| DeviceSecret | String | sLefbFmN9SYfnWLJTePG893XNuRV**** | 设备密钥。 |
| DeviceStatus | String | ONLINE | 设备状态。取值:ONLINE:设备在线。OFFLINE:设备离线。UNACTIVE:设备未激活。DISABLE:设备已禁用。 |
| GmtCreate | String | Wed, 20-Feb-2019 02:16:09 GMT | 设备创建时间,GMT格式。 |
| GmtModified | String | Wed, 20-Feb-2019 02:16:09 GMT | 设备信息最后一次更新时的时间,GMT格式。 |
| IotId | String | 70290207599388***** | 设备ID。物联网平台为该设备颁发的ID,设备的唯一标识符。 |
| Nickname | String | 智能灯设备 | 设备的备注名称。 |
| ProductKey | String | a1BwAGV**** | 设备所隶属的产品ProductKey。 |
| UtcCreate | String | 2019-02-20T02:16:09.000Z | 设备创建时间,UTC格式。 |
| UtcModified | String | 2019-02-20T02:16:09.000Z | 设备信息最后一次更新时的时间,UTC格式。 |
| ErrorMessage | String | 系统异常 | 调用失败时,返回的出错信息。 |
| Page | Integer | 1 | 当前页面号。 |
| PageCount | Integer | 1 | 总页数。 |
| PageSize | Integer | 10 | 每页显示的设备数。 |
| RequestId | String | qMZ1B0BEC30q8ZRSEqvXu4Od5tVgLwIf | 平台为该请求生成的唯一标识符。 |
| Success | Boolean | true | 是否调用成功。true:调用成功。false:调用失败。 |
| Total | Integer | 2 | 设备总数。 |
# 示例
请求示例
http://open.${区域}.fenydata.com/fenydata-java-open/?Action=QueryDevice
&ProductKey=aldafD****
&IotInstanceId=70255861902711****
&PageSize=10
&CurrentPage=1
&<公共请求参数>
正常返回示例
XML格式
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xml>
<PageCount>1</PageCount>
<Data>
<DeviceInfo>
<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>70255861902711****</IotId>
<DeviceStatus>UNACTIVE</DeviceStatus>
<Nickname>SensorInShanghai</Nickname>
</DeviceInfo>
<DeviceInfo>
<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>70255861902711****</IotId>
<DeviceStatus>UNACTIVE</DeviceStatus>
<Nickname>DriverInShanghai</Nickname>
</DeviceInfo>
</Data>
<Page>1</Page>
<PageSize>10</PageSize>
<RequestId>DnHw7JT5nUfW7zYb92S03SXdNszaG9o7</RequestId>
<Success>true</Success>
<Total>2</Total>
</xml>
JSON格式
{
"PageCount": 1,
"Data": {
"DeviceInfo": [
{
"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": "70255861902711****",
"DeviceStatus": "UNACTIVE",
"Nickname": "SensorInShanghai"
},
{
"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": "70255861902711****",
"DeviceStatus": "UNACTIVE",
"Nickname": "DriverInShanghai"
}
]
},
"Page": 1,
"PageSize": 10,
"RequestId": "DnHw7JT5nUfW7zYb92S03SXdNszaG9o7",
"Success": true,
"Total": 2
}