该接口支持根据 ID 查询设备详情。metadata 包含设备的属性、功能、事件、标签。
请求接口
GET /api/device/instance/{id}/detail
请求参数
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
id | path | string | 是 | 设备 ID |
X-Access-Token | header | string | 是 | 平台 token |
响应参数
以200 Response为例,响应参数如下:
名称 | 类型 | 必选 | 约束 | 说明 |
---|---|---|---|---|
» message | string | true | none | 返回信息 |
» result | object | true | none | 返回结果 |
»» id | string | false | none | ID |
»» name | string | false | none | 名称 |
»» productPhotoUrl | string | false | none | 产品图片URL |
»» devicePhotoUrl | string | false | none | 设备图片URL |
»» protocol | string | false | none | 协议ID |
»» protocolName | string | false | none | 协议名称 |
»» transport | string | false | none | 连接协议 |
»» productId | string | false | none | 产品ID |
»» productName | string | false | none | 产品名称 |
»» deviceType | object | false | none | 设备类型 |
»»» text | string | true | none | 设备类型名称 |
»»» value | string | true | none | 设备类型标识 |
»» state | integer | false | none | 状态 |
»»» text | string | true | none | 状态名称 |
»»» value | string | true | none | 状态标识 |
»» address | string | false | none | - |
»» onlineTime | integer | false | none | 上线时间 |
»» offlineTime | integer | false | none | 离线时间 |
»» createTime | integer | false | none | 创建时间 |
»» registerTime | integer | false | none | 注册时间 |
»» metadata | string | false | none | 物模型 |
»» independentMetadata | boolean | false | none | 是否为独立物模型 |
»» configuration | object | false | none | 配置信息 |
»»» secureId | string | true | none | MQTT密钥ID |
»»» secureKey | string | true | none | MQTT密钥Key |
»»» channelId | string | true | none | 通道ID |
»» classifiedId | string | false | none | 分类ID |
»» classifiedName | string | false | 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 | 成功 | Inline |
返回示例
以200 Response为例:
json
{
"message": "success",
"result": {
"id": "one",
"name": "one",
"productPhotoUrl": "/images/card/product.png",
"devicePhotoUrl": "/images/card/product.png",
"protocol": "d79e86511a67fc42fc0683a3917de033",
"protocolName": "内置协议",
"transport": "MQTT",
"productId": "testMQTT",
"productName": "testMQTT",
"deviceType": {
"text": "网关设备",
"value": "gateway"
},
"state": {
"text": "离线",
"value": "offline"
},
"address": "/218.17.51.10:15379",
"onlineTime": 1690961867404,
"offlineTime": 1690963448244,
"createTime": 1690883503947,
"registerTime": 1690883503968,
"metadata": "{\"functions\":[],\"properties\":[{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"网络\",\"description\":\"网络\",\"id\":\"real_state_net\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"AI加速卡\",\"description\":\"AI加速卡\",\"id\":\"real_state_ai_accelerator_card\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"边缘运行时版本\",\"description\":\"边缘运行时版本\",\"id\":\"real_state_runtime_version\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"Docker版本\",\"description\":\"Docker版本\",\"id\":\"real_state_docker_version\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"系统版本\",\"description\":\"系统版本\",\"id\":\"real_state_system_version\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"操作系统\",\"description\":\"操作系统\",\"id\":\"real_state_system\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"存储使用率\",\"description\":\"存储使用率\",\"id\":\"real_state_storage_usage_rate\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"存储大小\",\"description\":\"存储大小\",\"id\":\"real_state_storage_capacity\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"内存使用率\",\"description\":\"内存使用率\",\"id\":\"real_state_ram_usage_rate\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"内存大小\",\"description\":\"内存大小\",\"id\":\"real_state_ram_capacity\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"CPU架构\",\"description\":\"CPU架构\",\"id\":\"real_state_cpu_architecture\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"CPU使用率\",\"description\":\"CPU使用率\",\"id\":\"real_state_cpu_usage_rate\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"CPU大小\",\"description\":\"CPU大小\",\"id\":\"real_state_cpu_capacity\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}}],\"events\":[],\"tags\":[]}",
"independentMetadata": false,
"configuration": {
"secureId": "admin",
"secureKey": "admin",
"channelId": "a5bfaab341a7696821e1b6fa924ce7d6"
},
"deviceConfiguration": {},
"cachedConfiguration": {},
"aloneConfiguration": false,
"connectServerId": "",
"edge": false,
"tags": [],
"binds": [],
"features": [
{
"id": "eventNotInsertable",
"name": "物模型事件不可新增",
"deprecated": false,
"type": "SimpleFeature"
},
{
"id": "eventNotModifiable",
"name": "物模型事件不可修改",
"deprecated": false,
"type": "SimpleFeature"
}
],
"relations": [
{
"objectId": "one",
"relation": "werewr",
"relationName": "few"
},
{
"objectId": "one",
"relation": "oleman",
"relationName": "老人"
}
],
"accessId": "5d54ccff16e93c7d15e92a13d5ee10ec",
"accessProvider": "mqtt-server-gateway",
"accessName": "开鸿超级设备接入网关",
"classifiedId": "-20-201-20101-",
"classifiedName": "开鸿控制器",
"presetType": {
"text": "非内置",
"value": "none"
},
"superDeviceType": {
"text": "普通设备",
"value": "normalDevice"
},
"mediaDevice": false
},
"status": 200,
"timestamp": 1690964545164
}
{
"message": "success",
"result": {
"id": "one",
"name": "one",
"productPhotoUrl": "/images/card/product.png",
"devicePhotoUrl": "/images/card/product.png",
"protocol": "d79e86511a67fc42fc0683a3917de033",
"protocolName": "内置协议",
"transport": "MQTT",
"productId": "testMQTT",
"productName": "testMQTT",
"deviceType": {
"text": "网关设备",
"value": "gateway"
},
"state": {
"text": "离线",
"value": "offline"
},
"address": "/218.17.51.10:15379",
"onlineTime": 1690961867404,
"offlineTime": 1690963448244,
"createTime": 1690883503947,
"registerTime": 1690883503968,
"metadata": "{\"functions\":[],\"properties\":[{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"网络\",\"description\":\"网络\",\"id\":\"real_state_net\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"AI加速卡\",\"description\":\"AI加速卡\",\"id\":\"real_state_ai_accelerator_card\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"边缘运行时版本\",\"description\":\"边缘运行时版本\",\"id\":\"real_state_runtime_version\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"Docker版本\",\"description\":\"Docker版本\",\"id\":\"real_state_docker_version\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"系统版本\",\"description\":\"系统版本\",\"id\":\"real_state_system_version\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"操作系统\",\"description\":\"操作系统\",\"id\":\"real_state_system\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"存储使用率\",\"description\":\"存储使用率\",\"id\":\"real_state_storage_usage_rate\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"存储大小\",\"description\":\"存储大小\",\"id\":\"real_state_storage_capacity\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"内存使用率\",\"description\":\"内存使用率\",\"id\":\"real_state_ram_usage_rate\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"内存大小\",\"description\":\"内存大小\",\"id\":\"real_state_ram_capacity\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"CPU架构\",\"description\":\"CPU架构\",\"id\":\"real_state_cpu_architecture\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"CPU使用率\",\"description\":\"CPU使用率\",\"id\":\"real_state_cpu_usage_rate\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}},{\"valueType\":{\"expands\":{},\"type\":\"string\"},\"name\":\"CPU大小\",\"description\":\"CPU大小\",\"id\":\"real_state_cpu_capacity\",\"expands\":{\"source\":\"device\",\"metrics\":[],\"type\":[\"read\",\"report\"]}}],\"events\":[],\"tags\":[]}",
"independentMetadata": false,
"configuration": {
"secureId": "admin",
"secureKey": "admin",
"channelId": "a5bfaab341a7696821e1b6fa924ce7d6"
},
"deviceConfiguration": {},
"cachedConfiguration": {},
"aloneConfiguration": false,
"connectServerId": "",
"edge": false,
"tags": [],
"binds": [],
"features": [
{
"id": "eventNotInsertable",
"name": "物模型事件不可新增",
"deprecated": false,
"type": "SimpleFeature"
},
{
"id": "eventNotModifiable",
"name": "物模型事件不可修改",
"deprecated": false,
"type": "SimpleFeature"
}
],
"relations": [
{
"objectId": "one",
"relation": "werewr",
"relationName": "few"
},
{
"objectId": "one",
"relation": "oleman",
"relationName": "老人"
}
],
"accessId": "5d54ccff16e93c7d15e92a13d5ee10ec",
"accessProvider": "mqtt-server-gateway",
"accessName": "开鸿超级设备接入网关",
"classifiedId": "-20-201-20101-",
"classifiedName": "开鸿控制器",
"presetType": {
"text": "非内置",
"value": "none"
},
"superDeviceType": {
"text": "普通设备",
"value": "normalDevice"
},
"mediaDevice": false
},
"status": 200,
"timestamp": 1690964545164
}
- metadata
物模型
- 去转义格式化之后得到 json 格式的物模型数据。
json
{
"functions": [],
"properties": [{
"valueType": {
"expands": {},
"type": "string"
},
"name": "网络",
"description": "网络",
"id": "real_state_net",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "AI加速卡",
"description": "AI加速卡",
"id": "real_state_ai_accelerator_card",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "边缘运行时版本",
"description": "边缘运行时版本",
"id": "real_state_runtime_version",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "Docker版本",
"description": "Docker版本",
"id": "real_state_docker_version",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "系统版本",
"description": "系统版本",
"id": "real_state_system_version",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "操作系统",
"description": "操作系统",
"id": "real_state_system",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "存储使用率",
"description": "存储使用率",
"id": "real_state_storage_usage_rate",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "存储大小",
"description": "存储大小",
"id": "real_state_storage_capacity",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "内存使用率",
"description": "内存使用率",
"id": "real_state_ram_usage_rate",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "内存大小",
"description": "内存大小",
"id": "real_state_ram_capacity",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "CPU架构",
"description": "CPU架构",
"id": "real_state_cpu_architecture",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "CPU使用率",
"description": "CPU使用率",
"id": "real_state_cpu_usage_rate",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "CPU大小",
"description": "CPU大小",
"id": "real_state_cpu_capacity",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}],
"events": [],
"tags": []
}
{
"functions": [],
"properties": [{
"valueType": {
"expands": {},
"type": "string"
},
"name": "网络",
"description": "网络",
"id": "real_state_net",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "AI加速卡",
"description": "AI加速卡",
"id": "real_state_ai_accelerator_card",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "边缘运行时版本",
"description": "边缘运行时版本",
"id": "real_state_runtime_version",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "Docker版本",
"description": "Docker版本",
"id": "real_state_docker_version",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "系统版本",
"description": "系统版本",
"id": "real_state_system_version",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "操作系统",
"description": "操作系统",
"id": "real_state_system",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "存储使用率",
"description": "存储使用率",
"id": "real_state_storage_usage_rate",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "存储大小",
"description": "存储大小",
"id": "real_state_storage_capacity",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "内存使用率",
"description": "内存使用率",
"id": "real_state_ram_usage_rate",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "内存大小",
"description": "内存大小",
"id": "real_state_ram_capacity",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "CPU架构",
"description": "CPU架构",
"id": "real_state_cpu_architecture",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "CPU使用率",
"description": "CPU使用率",
"id": "real_state_cpu_usage_rate",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}, {
"valueType": {
"expands": {},
"type": "string"
},
"name": "CPU大小",
"description": "CPU大小",
"id": "real_state_cpu_capacity",
"expands": {
"source": "device",
"metrics": [],
"type": ["read", "report"]
}
}],
"events": [],
"tags": []
}