硬件管理
硬件管理接口用于管理硬件设备。所有接口都需要管理员权限。
获取硬件列表
获取硬件设备列表。请求参数
| 参数名 | 类型 | 必选 | 说明 |
|---|
| page | integer | 否 | 页码,默认1 |
| size | integer | 否 | 每页数量 |
| status | string | 否 | 设备状态 |
GET /admin/hardware/list?page=1&size=10&status=active
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
更新硬件信息
更新指定硬件的信息。请求参数
| 参数名 | 类型 | 必选 | 说明 |
|---|
| id | string | 是 | 硬件ID |
| name | string | 否 | 硬件名称 |
| description | string | 否 | 硬件描述 |
| config | object | 否 | 硬件配置 |
PUT /admin/hardware/hw_123
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
{
"name": "更新后的设备",
"description": "这是更新后的设备描述",
"config": {
"type": "sensor",
"model": "v2.0"
}
}
同步SIM卡信息
/admin/hardware/:id/sync_sim
同步指定硬件的SIM卡信息。请求参数
POST /admin/hardware/hw_123/sync_sim
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
重置硬件
/admin/hardware/:id/reset
重置指定的硬件设备。请求参数
| 参数名 | 类型 | 必选 | 说明 |
|---|
| id | string | 是 | 硬件ID |
| mode | string | 否 | 重置模式 |
POST /admin/hardware/hw_123/reset
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
{
"mode": "factory"
}
错误码说明
错误码说明
| 错误码 | 说明 |
|---|
| 400 | 请求参数错误 |
| 401 | 未授权或令牌无效 |
| 403 | 权限不足(需要管理员权限) |
| 404 | 硬件不存在 |
| 422 | 请求参数验证失败 |
| 500 | 服务器错误 |