🔍 Beacon API 接口文档

以下是所有可用的API接口:

GET /api/health

健康检查接口,返回服务器状态信息

测试链接: /api/health

GET /api/beacons/latest

获取最新设备状态列表

参数: limit (数量限制), sort (排序字段), order (排序方向)

测试链接: /api/beacons/latest?limit=10

GET /api/devices/stats

获取设备统计信息

测试链接: /api/devices/stats

GET /api/beacons/recent

获取最近上传记录

参数: limit (数量限制)

测试链接: /api/beacons/recent?limit=10

GET /api/beacons/trend

获取24小时活动趋势

测试链接: /api/beacons/trend

GET /api/beacons/history/:mac

获取指定设备的历史记录

参数: mac (MAC地址), limit (数量限制)

示例: /api/beacons/history/AA:BB:CC:DD:EE:FF?limit=20

POST /api/beacons/upload

上传设备数据(Android应用使用)

需要JSON数据体,包含设备信息

POST /api/admin/clear-all

清空所有数据(需要管理密码)

危险操作,需要密码验证

GET /api/admin/export/json

导出所有数据为JSON格式

测试链接: /api/admin/export/json

GET /api/admin/export/csv

导出数据为CSV格式

参数: table (表名: latest_status, history, uploads, devices)

测试链接: /api/admin/export/csv?table=latest_status

GET /api/admin/database/status

获取数据库状态信息

测试链接: /api/admin/database/status

返回监控仪表板