实时遥测
获取指定设备最新一次上报的遥测与状态数据。返回的数据反映设备最近一次与平台通信时的快照,字段内容因设备类型而有所差异。
| 项目 | 内容 |
|---|---|
| 方法 | GET |
| URL | https://devapi.fengshengshou.com/api/devices/{id}/telemetry/latest |
| 鉴权 | 是,请求头携带 Authorization: Bearer your_token_here |
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | int | 是 | 路径参数,设备 ID |
本接口无额外查询参数。
curl -X GET "https://devapi.fengshengshou.com/api/devices/101/telemetry/latest" \ -H "Authorization: Bearer your_token_here" \ -H "Accept: application/json"| 字段 | 类型 | 说明 |
|---|---|---|
| code | int | 状态码,0 表示成功 |
| message | string | 响应描述 |
| data.device_id | int | 设备 ID |
| data.device_no | string | 设备编号 |
| data.online_status | int | 在线状态:1 = 在线,0 = 离线 |
| data.is_online | bool | 是否在线 |
| data.last_online_at | string|null | 最近上线时间,可为空 |
| data.reported_at | string|null | 最近遥测数据上报时间,可为空 |
| data.device_type_code | string | 设备类型代码 |
| data.status | object | 设备状态值(结构因设备类型而异) |
| data.battery | number|null | 电量百分比(0–100),可为空 |
| data.pose | object|null | 姿态信息(如偏航角、俯仰角等),可为空 |
| data.location | object|null | 位置坐标信息,可为空 |
| data.source | string|null | 数据来源标识,可为空 |
{ "code": 0, "message": "success", "data": { "device_id": 101, "device_no": "DEV-2024-001", "online_status": 1, "is_online": true, "last_online_at": "2026-07-05 10:23:45", "reported_at": "2026-07-05 10:23:40", "device_type_code": "inspection_robot", "status": { "motion": "idle", "task_id": null }, "battery": 87.5, "pose": { "yaw": 45.0, "pitch": 0.0, "roll": 0.2 }, "location": { "longitude": 121.473701, "latitude": 31.230416, "altitude": 5.2 }, "source": "mqtt" }}{ "code": 404, "message": "设备不存在", "data": null}{ "code": 30002, "message": "无设备查看权限", "data": null}