V2.5 Search Device by Device Group¶
通过设备组查询设备信息。
请求格式¶
POST https://{apigw-address}/connect-service/v2.5/deviceGroups?action=searchDeviceByDeviceGroup
请求参数(Body)¶
名称 | 必需/可选 | 数据类型 | 描述 |
---|---|---|---|
groupId | 必需 | String | 设备组ID |
expression | 可选 | String | 查询表达式。如何使用查询表达式>> |
pagination | 可选 | Pagination 请求结构体 | 随机分页。如未指定,默认每页 10 条。每页最大记录数为 1,000 条,但为获得最佳性能,建议每页不超过 50 条。EnOS Edge 单页最大上限为 3,000 条。支持使用 sorters 参数对结果进行排序。Pagination 请求结构体>> |
响应参数¶
名称 | 数据类型 | 描述 |
---|---|---|
code | Number | 更新成功或失败的指示码。 |
msg | String | 成功时返回 OK ;其他值则为失败。 |
requestId | String | 每次请求获取的 ID,用于唯一标识一次 API 请求。 |
data | Device 结构体 | 参见 Device 结构体。 |
pagination | Pagination 请求结构体 | 参见 Pagination 请求结构体>> |
Device 结构体 ¶
名称 | 数据类型 | 描述 |
---|---|---|
orgId | String | 资产所属的组织 ID。 |
assetId | String | 资产 ID。 |
modelId | String | 资产所属模型 ID。 |
modelIdPath | String | 模型 ID 的路径。 |
productKey | String | Product Key。 |
productName | StringI18n | 产品名称。 |
productType | String | 产品类型。 |
dataFormat | String | 数据格式。Custom 表示支持用户自定义数据格式,Json 表示只支持 EnOS 设备协议格式。 |
deviceKey | String | Device Key。 |
deviceName | StringI18n | 设备名称。 |
deviceSecret | String | 设备连接密钥,仅当 requireSecret 为 true 时返回。返回值已经过加密处理。如何解密 Device Secret >> |
sessionKey | String | 配合解密 deviceSecret 的参数,仅当 requireSecret 为 true 时返回。返回值已经过加密处理。如何解密 Device Secret >> |
deviceDesc | String | 设备描述。 |
timezone | String | 设备所在时区。 |
deviceAttributes | Map(Key 和 Value 为 string) | 设备的属性。 |
deviceTags | Map(Key 和 Value 为 string) | 设备的标志。 |
mirrorSource | String | 镜像源设备的 device key。 |
createTime | Long | 设备的创建时间。 |
status | String | 设备的状态(online、offline、inactive、disable 或 mirror)。
|
activeTime | Long | 设备的激活时间。 |
lastOnlineTime | Long | 设备最后一次上线时间。 |
lastOfflineTime | Long | 设备最后一次离线时间。 |
measurepointLastUpdate | Long | 设备测点最近一次更新的时间。 |
eventLastUpdate | Long | 设备事件最近一次更新的时间。 |
attributeLastUpdate | Long | 设备属性最近一次更新的时间。 |
featureLastUpdate | Long | 设备最近一次更新的时间,以上述三个时间( measurepointLastUpdate 、 eventLastUpdate 、 attributeLastUpdate )里最近的时间为准。 |
firmwareVersion | String | 固件版本号。 |
示例¶
请求示例¶
url: https://{apigw-address}/connect-service/v2.5/deviceGroups?action=searchDeviceByDeviceGroup&orgId=yourOrgId&groupId=yourGroupId
method: POST
返回示例¶
{
"code": 0,
"msg": "OK",
"requestId": "4b64be78-72c6-4eee-8cc5-227f0d0d2a5a",
"data": [{
"orgId": "yourOrgId",
"assetId": "assetId",
"modelId": "modelId",
"modelIdPath": "modelIdPath",
"productKey": "productKey",
"productName": {
"defaultValue": "ProductName",
"i18nValue": {
"en_US": "name",
"zh_CN": "名称"
}
},
"productType": "Device",
"dataFormat": "Custom",
"deviceKey": "deviceKey",
"deviceName": {
"defaultValue": "deviceName_test",
"i18nValue": {
"en_US": "name",
"zh_CN": "名称"
}
},
"deviceSecret": null,
"sessionKey": null,
"deviceDesc": "Device description",
"timezone": "+08:00",
"deviceAttributes": {
"attribute1": "value1",
"attribute2": "value2"
},
"deviceTags": {
"tag1": "tagValue1",
"tag2": "tagValue2"
},
"mirrorSource": null,
"firmwareVersion": null,
"createTime": 1718950104553,
"status": "inactive",
"statusSource": null,
"activeTime": 0,
"lastOnlineTime": 0,
"lastOfflineTime": 0,
"treeIds": [],
"measurepointLastUpdate": null,
"eventLastUpdate": null,
"attributeLastUpdate": null,
"featureLastUpdate": null
}],
"pagination": {
"sortedBy": null,
"pageNo": 1,
"pageSize": 100,
"totalSize": 1
}
}