该接口用于根据参数查询设备列表信息,支持模糊查询。
请求接口
POST /api/device-instance/_query/
请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| X-Access-Token | header | string | 是 | 平台 token |
| body | body | object | 否 | - |
| » pageSize | body | integer | 否 | 每页数量 |
| » pageIndex | body | integer | 否 | 页码,从 0 开始 |
| » sorts | body | [object] | 否 | 排序,可以根据多个字段排序 |
| »» name | body | string | 否 | 排序字段名称 |
| »» order | body | string | 否 | 排序方式:asc(升序)、desc(降序) |
| » terms | body | [object] | 否 | 查询条件 |
| »» terms | body | [object] | 否 | 查询条件 |
| »»» column | body | string | 否 | 条件属性名称,可选值:id(设备id)、name(设备名称)、productId(所属产品)、state(状态)、superDeviceType(网关类型)、deviceType(设备类型)、classifiedId(产品分类) |
| »»» value | body | string | 否 | 条件属性值 |
| »»» termType | body | string | 否 | 查询条件:like(模糊查询)、eq(等于) |
| »»» type | body | string | 否 | 多个条件关联类型,可选值:or、and |
| » current | body | integer | 否 | 当前页面 |
响应参数
以200 Response为例,响应参数如下:
| 名称 | 类型 | 必选 | 约束 | 说明 |
|---|---|---|---|---|
| » message | string | true | none | 返回信息 |
| » result | object | true | none | 返回结果 |
| »» pageIndex | integer | true | none | 页码,从0开始 |
| »» pageSize | integer | true | none | 每页数量 |
| »» total | integer | true | none | 总数 |
| »» data | [object] | true | none | 数据 |
| »»» id | string | true | none | ID |
| »»» name | string | true | none | 设备名称 |
| »»» photoUrl | string | true | none | 设备图片URL |
| »»» deviceType | object | true | none | 设备类型 |
| »»»» text | string | true | none | 内容 |
| »»»» value | string | true | none | 值 |
| »»» productId | string | true | none | 产品ID |
| »»» productName | string | true | none | 产品名称 |
| »»» configuration | string | true | none | 配置信息 |
| »»»» secureId | string | true | none | 密钥ID |
| »»»» channelId | string | true | none | 通道ID |
| »»»» secureKey | string | true | none | 密钥Key |
| »»» deviceMetadata | string | false | none | 设备物模型 |
| »»» state | object | false | none | 设备状态 |
| »»»» text | string | true | none | 内容 |
| »»»» value | string | true | none | 值 |
| »»»edge | boolean | true | none | 是否为边缘设备 |
| »»» creatorId | string | true | none | 创建者ID |
| »»» creatorName | string | true | none | 创建者姓名 |
| »»» creatTime | string | true | none | 创建时间 |
| »»» registryTime | string | true | none | 注册时间 |
| »»» features | [object] | true | none | 设备特性 |
| »»» virtualType | object | false | none | 虚拟类型 |
| »»»» text | string | true | none | 内容 |
| »»»» value | string | true | none | 值 |
| »»»superDeviceType | object | false | none | 超级设备类型 |
| »»»» text | string | true | none | 内容 |
| »»»» value | string | true | none | 值 |
| »»» state | object | false | none | 状态 |
| »»»» text | string | true | none | 内容 |
| »»»» value | string | true | none | 值 |
| »»» configuration | object | false | none | 配置信息 |
| »»»» secureId | string | true | none | MQTT密钥ID |
| »»»» secureKey | string | true | none | MQTT密钥Key |
| »»» state | [object] | false | none | 状态 |
| »»»» text | string | true | none | 内容 |
| »»»» value | string | true | none | 值 |
| »»» creatorId | string | false | none | 创建者ID |
| »»» createTime | integer | false | none | 创建时间 |
| »»» orgId | string | false | none | 组织ID |
| »»» storePolicy | string | false | none | 数据存储策略 |
| » status | integer | true | none | 响应状态码 |
| » timestamp | integer | true | none | 时间戳 |
响应状态码
| 状态码 | 状态码含义 | 说明 |
|---|---|---|
| 200 | OK | 成功 |
| 401 | Unauthorized | 登录状态已过期,token不能为空 |
| 500 | Internal Server Error | 服务器内部异常 |
Body示例
json
{
"current":1,
"pageSize":1,
"pageIndex":0,
"terms":[
{
"terms":[
{
"termType":"eq",
"column":"superDeviceType",
"value":"normalDevice",
"type":"and"
}
]
}
],
"sorts":[
{
"name":"createTime",
"order":"desc"
}
]
}{
"current":1,
"pageSize":1,
"pageIndex":0,
"terms":[
{
"terms":[
{
"termType":"eq",
"column":"superDeviceType",
"value":"normalDevice",
"type":"and"
}
]
}
],
"sorts":[
{
"name":"createTime",
"order":"desc"
}
]
}返回示例
以200 Response为例:
json
{
"message": "success",
"result": {
"pageIndex": 0,
"pageSize": 19,
"total": 914,
"data": [
{
"id": "ceshi",
"photoUrl": "/images/card/product.png",
"name": "%",
"deviceType": {
"text": "直连设备",
"value": "device"
},
"productId": "yz-prd",
"productName": "yz-直连产品",
"state": {
"text": "离线",
"value": "offline"
},
"edge": false,
"superDeviceType": {
"text": "普通设备",
"value": "normalDevice"
},
"creatorId": "1199596756811550720",
"creatorName": "\t\r\n室内安防",
"createTime": 1690525378505,
"registryTime": 1690525378524,
"features": [],
"virtualType": {
"text": "真实设备",
"value": "real"
},
"regulator": false,
"comeFrom": {
"text": "云生成",
"value": "cloud"
},
"deviceCreateType": {
"text": "根据产品(超级设备模型)生成",
"value": "fromProduct"
},
"modifyTime": 1690525378505,
"modifierId": "1199596756811550720",
"modifierName": "\t\r\n室内安防",
"presetType": {
"text": "非内置",
"value": "none"
},
"categoryType": {
"text": "默认类型",
"value": "none"
},
"mediaDevice": false
}
]
},
"status": 200,
"timestamp": 1690869409124
}{
"message": "success",
"result": {
"pageIndex": 0,
"pageSize": 19,
"total": 914,
"data": [
{
"id": "ceshi",
"photoUrl": "/images/card/product.png",
"name": "%",
"deviceType": {
"text": "直连设备",
"value": "device"
},
"productId": "yz-prd",
"productName": "yz-直连产品",
"state": {
"text": "离线",
"value": "offline"
},
"edge": false,
"superDeviceType": {
"text": "普通设备",
"value": "normalDevice"
},
"creatorId": "1199596756811550720",
"creatorName": "\t\r\n室内安防",
"createTime": 1690525378505,
"registryTime": 1690525378524,
"features": [],
"virtualType": {
"text": "真实设备",
"value": "real"
},
"regulator": false,
"comeFrom": {
"text": "云生成",
"value": "cloud"
},
"deviceCreateType": {
"text": "根据产品(超级设备模型)生成",
"value": "fromProduct"
},
"modifyTime": 1690525378505,
"modifierId": "1199596756811550720",
"modifierName": "\t\r\n室内安防",
"presetType": {
"text": "非内置",
"value": "none"
},
"categoryType": {
"text": "默认类型",
"value": "none"
},
"mediaDevice": false
}
]
},
"status": 200,
"timestamp": 1690869409124
}