设备管理
更新时间: 2023-04-19
# cvs导入设备
# 基本信息
Path: /v1/devices/:instanceId/:productKey/csv/import
Method: POST
接口描述:
# 请求参数
Headers
参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
---|---|---|---|---|
Content-Type | multipart/form-data | 是 |
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
instanceId | ||
productKey |
Body
参数名称 | 参数类型 | 是否必须 | 示例 | 备注 |
---|---|---|---|---|
importFile | file | 是 | cvs格式 deviceName,deviceSecert,alias dev1,xxx,alias1 dev2,xxx,alias2 |
# 返回数据
无
# 创建设备
# 基本信息
Path: /v1/devices/:instanceId/:productKey
Method: POST
接口描述:
# 请求参数
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
instanceId | ||
productKey |
Body
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
alias | string | 非必须 | 备注名称,最大64字符,可为汉字、大小写英文、数字、中线、下划线。^[\u4e00-\u9fa5a-zA-Z0-9\-_]{0,64}$ | ||
deviceName | string | 必须 | DeviceName,1~40字符, 可为大小写英文、数字、下划线。不填时由系统自动生成。^[a-zA-Z0-9_]{1,40}$ | ||
deviceSecret | string | 非必须 | 可选参数,不填时由系统生成,^[-_a-zA-Z0-9]{1,64}$ |
# 返回数据
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
instanceId | string | 非必须 | |||
productKey | string | 非必须 | |||
productName | string | 非必须 | |||
deviceType | string | 非必须 | |||
accessType | string | 非必须 | 联网方式/接入网关协议 | ||
deviceName | string | 非必须 | ^[a-zA-Z0-9_]{1,40}$, 1~40字符, 可为大小写英文、数字、下划线。 | ||
deviceSecret | string | 非必须 | 1~64字符, 大小写英文、数字、中线、下划线,不填时系统自动生成 | ||
alias | string | 非必须 | ^[\u4e00-\u9fa5a-zA-Z0-9\-_]{0,64}$, 最大64字符,可为汉字、大小写英文、数字、中线、下划线。 | ||
active_state | boolean | 非必须 | 激活状态: false: 未激活, ture: 已激活 | ||
active_time | string | 非必须 | 激活时间 | ||
online_state | string | 非必须 | 离在线状态: false: 离线, true: 在线 | ||
last_online_time | string | 非必须 | 最后在线时间 | ||
enable_state | string | 非必须 | 启用/禁用状态: false: 禁用, true: 启用 | ||
ban_state | string | 非必须 | 封禁状态: false: 未封禁, true: 已封禁 | ||
createTime | string | 非必须 | |||
updateTime | string | 非必须 |
# 删除设备
# 基本信息
Path: /v1/devices/:instanceId/:productKey/:deviceName
Method: DELETE
接口描述:
# 请求参数
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
instanceId | ||
productKey | ||
deviceName |
# 返回数据
无
# 发送消息到设备
# 基本信息
Path: /v1/services/:instanceId/:productKey/:deviceName/message
Method: POST
接口描述:
# 请求参数
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
instanceId | ||
productKey | ||
deviceName |
Body
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
topic | string | 必须 | |||
message | string | 必须 |
# 返回数据
无
# 批量创建设备
# 基本信息
Path: /v1/devices/:instanceId/:productKey/batch
Method: POST
接口描述:
# 请求参数
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
instanceId | ||
productKey |
Body
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
devices | object [] | 非必须 | |||
├─ deviceName | string | 必须 | |||
├─ alias | string | 非必须 | |||
├─ deviceSecret | string | 非必须 |
# 返回数据
无
# 批量删除设备
# 基本信息
Path: /v1/devices/:instanceId/batch/delete
Method: PUT
接口描述:
# 请求参数
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
instanceId |
Body
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
devices | object [] | 必须 | |||
├─ deviceName | string | 必须 | |||
├─ productKey | string | 必须 |
# 返回数据
无
# 更新设备
# 基本信息
Path: /v1/devices/:instanceId/:productKey/:deviceName
Method: PUT
接口描述:
# 请求参数
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
instanceId | ||
productKey | ||
deviceName |
Body
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
alias | string | 非必须 |
# 返回数据
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
active_time | string | 非必须 | |||
createTime | string | 非必须 | |||
online_state | string | 非必须 | |||
deviceName | string | 非必须 | |||
productKey | string | 非必须 | |||
last_online_time | string | 非必须 | |||
productName | string | 非必须 | |||
active_state | boolean | 非必须 | |||
enable_state | string | 非必须 | |||
instanceId | string | 非必须 | |||
alias | string | 非必须 | |||
deviceSecret | string | 非必须 | |||
accessType | string | 非必须 | |||
deviceType | string | 非必须 | |||
ban_state | string | 非必须 | |||
updateTime | string | 非必须 |
# 查询设备列表
# 基本信息
Path: /v1/devices/:instanceId
Method: GET
接口描述:
# 请求参数
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
instanceId |
Query
参数名称 | 是否必须 | 示例 | 备注 |
---|---|---|---|
pageNo | 是 | ||
pageSize | 是 | ||
productKey | 否 | ||
alias | 否 | 支持alias/deviceName模糊查询 | |
tagKey | 否 | ||
tagValue | 否 | ||
groupId | 否 |
# 返回数据
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
totalCount | integer | 非必须 | |||
result | object [] | 非必须 | |||
├─ instanceId | string | 非必须 | |||
├─ productKey | string | 非必须 | |||
├─ productName | string | 非必须 | |||
├─ deviceType | string | 非必须 | |||
├─ authType | string | 非必须 | |||
├─ accessType | string | 非必须 | |||
├─ deviceName | string | 非必须 | |||
├─ deviceSecret | string | 非必须 | |||
├─ alias | string | 非必须 | |||
├─ active_state | boolean | 非必须 | |||
├─ active_time | string | 非必须 | |||
├─ online_state | string | 非必须 | |||
├─ last_online_time | string | 非必须 | |||
├─ enable_state | string | 非必须 | |||
├─ ban_state | string | 非必须 | |||
├─ createTime | string | 非必须 | |||
├─ updateTime | string | 非必须 | |||
productKey | string | 非必须 | |||
alias | string | 非必须 | |||
pageNo | integer | 非必须 | |||
pageSize | integer | 非必须 | |||
tagKey | string | 必须 | |||
tagValue | string | 必须 | |||
groupId | string | 必须 |
# 查询设备详情
# 基本信息
Path: /v1/devices/:instanceId/:productKey/:deviceName
Method: GET
接口描述:
# 请求参数
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
instanceId | ||
productKey | ||
deviceName |
# 返回数据
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
instanceId | string | 非必须 | |||
productKey | string | 非必须 | |||
productName | string | 非必须 | |||
deviceType | string | 非必须 | |||
authType | string | 非必须 | |||
accessType | string [] | 非必须 | |||
├─ | 非必须 | ||||
deviceName | string | 非必须 | |||
deviceSecret | string | 非必须 | |||
alias | string | 非必须 | |||
activeState | boolean | 非必须 | |||
activeTime | string | 非必须 | |||
onlineState | string | 非必须 | |||
lastOnlineTime | string | 非必须 | |||
enableState | string | 非必须 | |||
banState | string | 非必须 | |||
createTime | string | 非必须 | |||
updateTime | string | 非必须 | |||
accountUuid | string | 非必须 |
# 重置设备密钥
# 基本信息
Path: /v1/devices/:instanceId/:productKey/:deviceName/secret
Method: PUT
接口描述:
# 请求参数
路径参数
参数名称 | 示例 | 备注 |
---|---|---|
instanceId | ||
productKey | ||
deviceName |
# 返回数据
无