权限范围
访问 REST API 需要持有包含相应权限范围的 access token;本页列出所有权限范围及其适用端点。
权限范围列表
| Scope | 类型 | 用途 |
|---|---|---|
device:read | 只读 | 查询设备列表、设备详情、设备 Profile 和命令结果 |
device:control | 命令写入 | 包含 device:read 的全部查询权限,并可向设备下发操作命令 |
device:config | 配置写入 | 包含 device:read 的全部查询权限,并可修改设备参数配置 |
device:manage | 管理操作 | 包含 device:read 的全部查询权限,并可添加设备、移除设备、修改设备密码 |
端点权限要求
| 端点 | 所需权限范围 | 状态 |
|---|---|---|
GET /wlte/v1/devices | device:read | 可用 |
GET /wlte/v1/devices/{deviceId} | device:read | 可用 |
GET /wlte/v1/device-profiles | device:read | 可用 |
GET /wlte/v1/commands/{commandId} | device:read | 可用 |
POST /wlte/v1/devices/{deviceId}/relays/{index}/commands | device:control | 可用 |
PUT /wlte/v1/devices/{deviceId}/relays/{index}/jog-config | device:config | 即将上线 |
POST /wlte/v1/devices | device:manage | 即将上线 |
DELETE /wlte/v1/devices/{deviceId} | device:manage | 即将上线 |
PUT /wlte/v1/devices/{deviceId}/password | device:manage | 即将上线 |
访问边界
device:control、device:config和device:manage均包含device:read的全部权限,无需额外授予device:readdevice:control、device:config、device:manage相互独立,按集成需求分别授予- 查询命令结果时,客户端只能访问自己有权访问的设备下的命令
- 缺少认证、认证无效或 token 过期时返回
401 - 认证有效但权限范围不足时返回
403 AUTH_SCOPE_DENIED
