Skip to main content

硬件管理

硬件管理接口用于管理硬件设备。所有接口都需要管理员权限。

获取硬件列表

/admin/hardware/list
获取硬件设备列表。

请求参数

参数名类型必选说明
pageinteger页码,默认1
sizeinteger每页数量
statusstring设备状态
GET /admin/hardware/list?page=1&size=10&status=active
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

更新硬件信息

/admin/hardware/:id
更新指定硬件的信息。

请求参数

参数名类型必选说明
idstring硬件ID
namestring硬件名称
descriptionstring硬件描述
configobject硬件配置
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卡信息。

请求参数

参数名类型必选说明
idstring硬件ID
POST /admin/hardware/hw_123/sync_sim
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

重置硬件

/admin/hardware/:id/reset
重置指定的硬件设备。

请求参数

参数名类型必选说明
idstring硬件ID
modestring重置模式
POST /admin/hardware/hw_123/reset
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN

{
  "mode": "factory"
}

错误码说明

错误码说明

错误码说明
400请求参数错误
401未授权或令牌无效
403权限不足(需要管理员权限)
404硬件不存在
422请求参数验证失败
500服务器错误