提示
所有请求都需要在授权,登录状态下获取合法令牌后才能生效
# 1.获取数据 dev_list
# http 请求
---
method:get or post
url: http://内网IP:5000/category/dev_list
---
# 数据格式
本展厅集控服务器将返回所有设备配置JSON
格式信息:
发送 http 请求,如果请求成功,那么将会返回 JSON 数据,在 data 项中即为多媒体数据。
以开关机为例,其他外接设备类同:
[
{
"id": 1,
"number": 1,
"_del_": 0,
"title": "开关机",
"time": "2024-08-20 19:56:48",
"des": "控制PC指令",
"key": "pc",
"type": "client",
"server": "websocket",
"content": [
{
"id": 2,
"number": 1,
"_del_": 0,
"title": "业务主机",
"time": "2024-08-20 19:59:25",
"des": "",
"uid": "13802754",
"tag": "1128",
"key": "pc",
"ip": "192.168.10.105",
"cmds": {
"1": {
// ...
"flag": "pc.2.temp1"
}
},
"category": 1
}
]
}
]
# 属性说明
以开关机例进行属性说明:
"key": "pc",
"cmds":{
"flag": "pc.2.temp1" #标识
}
# 2.指令:状态 on
{cmd:{type:"on",flag:"pc.2.temp1",dev:"pc"}}
需要将设备数据中的 flag,和当前设备类型 "pc" 返回给后台,即属性说明中高亮部分。
# 3.指令:状态 off
{cmd:{type:"off",flag:"pc.2.temp1",dev:"pc"}}
# 4.指令:发送
发送 http 请求
---
method:get or post
url: http://内网IP:5000/category/dev_exec
---
返回请求:
{
"success": true,
"msg": "执行成功"
}
注意
sucess 为 true 表示该次请求成功完成,向目标设备发送了该指令,但并不意味着,指令执行成功,例如该设备并未上线,执行请求结果也会是 true。