查询单个设备信息
接口说明
应用服务器可调用此接口查询指定设备信息,可用于给用户展示设备详细信息或查询设备是否存在。
URI
| 请求方法 | GET |
|---|---|
| URI | /api/v3.0/devices/{deviceId} |
| 传输协议 | HTTPS |
请求参数
| 名称 | 必选/可选 | 类型 | 位置 | 说明 |
|---|---|---|---|---|
| app_key | 必选 | String | Header | 已鉴权应用的appId。 |
| Authorization | 必选 | String | Header | 请求的认证信息,值为“Bearer ******”,其中******为Auth鉴权接口返回的accessToken。 |
| deviceId | 必选 | String | Path | 设备ID。 |
| ownerAppId | 可选 | String | Query | 资源所属应用的appId,访问其他应用所持有的资源时需要填写。 |
响应参数
| 名称 | 类型 | 说明 |
|---|---|---|
| createTime | String | 创建时间。 |
| deviceId | String | 设备ID。 |
| deviceInfo | 设备信息。 | |
| gatewayId | String | 直连平台设备ID,设备通过该直连设备接入平台。 |
| nodeType | String | node类型,GATEWAY表示直连设备,ENDPOINT表示非直连设备。 |
| 名称 | 类型 | 说明 |
|---|---|---|
| batteryLevel | String(256) | 电池电量。 |
| bridgeId | String(256) | 表示设备通过哪个Bridge接入平台。 |
| description | String(2048) | 设备描述。 |
| deviceType | String(256) | 设备类型。 |
| fwVersion | String(256) | 固件版本。 |
| hwVersion | String(256) | 硬件版本。 |
| location | String(2048) | 设备位置。 |
| mac | String(256) | MAC地址。 |
| manufacturerId | String(256) | 厂商ID。 |
| manufacturerName | String(256) | 厂商名字。 |
| model | String(256) | 设备型号。 |
| name | String(256) | 设备名称。 |
| nodeId | String(256) | 对接平台的设备唯一标识。 |
| protocolType | String(256) | 协议类型。 |
| serialNumber | String(256) | 设备的序列号。 |
| sigVersion | String(256) | 设备的sig版本。 |
| signalStrength | String(256) | 信号强度。 |
| status | String | 表示设备状态。 |
| statusDetail | String(256) | 表示设备状态详情。 |
| supportedSecurity | String | 表示是否支持安全模式。 |
| swVersion | String(256) | 软件版本。 |
请求示例
GET https://{host}:{port}/api/v3.0/devices/{deviceId}?ownerAppId={ownerAppId}
Content-Type: application/json
app_key: ********
Authorization: ********
响应示例
Status Code: 200 OK
Content-Type: application/json
{
"createTime" : "string",
"deviceId" : "string",
"deviceInfo" : {
"deviceType" : "string",
"supportedSecurity" : "string",
"serialNumber" : "string",
"swVersion" : "string",
"manufacturerName" : "string",
"signalStrength" : "string",
"manufacturerId" : "string",
"description" : "string",
"statusDetail" : "string",
"protocolType" : "string",
"mac" : "string",
"hwVersion" : "string",
"sigVersion" : "string",
"bridgeId" : "string",
"name" : "string",
"fwVersion" : "string",
"location" : "string",
"model" : "string",
"nodeId" : "string",
"batteryLevel" : "string",
"status" : "string"
},
"gatewayId" : "string",
"nodeType" : "string"
} 错误码
| HTTP状态码 | HTTP状态码说明 | 错误码 | 错误码描述 |
|---|---|---|---|
| 200 | OK | 100403 | The device does not exist. 处理建议:设备已被删除或重新注册,可通过查询设备列表接口查询设备是否还在平台内。 |
| 100418 | The deviceData is not existed. 处理建议:设备已被删除或重新注册,可通过查询设备列表接口查询设备是否还在平台内。 | ||
| 400 | Bad Request | 100409 | The deviceId is invalid. 处理建议:检查并填写正确的deviceId。 |
| 401 | Unauthorized | 100025 | AppId for auth not exist. 处理建议:检查并填写正确的appId。 |
| 403 | Forbidden | 100203 | The application does not exist. 处理建议:检查并填写正确的appId。 |
| 100217 | The application hasn't been authorized. 处理建议:应用没有被授权,检查该应用是否有权限 |
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.