一般说明

密码加密

密码加密算法:BASE64(AES-192-ECB-PKCS7(密码明文,密钥))

密钥:USB License Key S/N。

参考示例:

USB License Key S/N:405591134000030009
Original Text: bosch123
Base64 Encrypted String: nXuY6Ds8gcr+DTIHdReE/A==
Base64 Decrypt String: bosch123

TOKEN 鉴权

  1. TOKEN:成功登陆广播系统后获得,用于接口鉴权。需要统一在header请求头设置 token: xxxxxx。

  2. FreshToken:成功广播系统后或Token刷新后获得。用于在Token刷新,调用刷新接口获取新的Token与FreshToken。不必进行重新登录,若Token过期则必须重新登录。Token与FreshToken有效期均为广播系统设置登录有效时间。

返回值JSON格式一

{
    "successful": true, 	// 结果标识,描述接口是否调用成功。true:成功;false:失败;
    "code": 200,			// HTTP返回值,结合msg说明接口具体调用情况;
    "msg": "Success",		// 请求结果说明;
    "data": [],			    // 广播系统返回数据;
    "timestamp": 0   	    // 服务器系统时间戳(精确到毫秒)。
}

返回值JSON格式二

{
    "successful": true,  	// 结果标识,描述接口是否调用成功。true:成功;false:失败;
    "code": 200,			// HTTP返回值,结合msg说明接口具体调用情况;
    "msg": "Success",		// 请求结果说明;
    "data": [],		  	    // 广播系统返回数据;
    "timestamp": 0,   		// 服务器系统时间戳(精确到毫秒);
    "totalCount": 0,		// 数据总数;
    "pageSize": 0,	  		// 当前页大小;
    "currPage": 0,     	    // 当前页码;
    "totalPage": 0			// 分页总数。
}

HTTP Code

HTTP返回值 Description

200

OK

201

Created

401

Unauthorized

403

Forbidden

404

Not Found

接口说明

POST 登录

http://192.168.1.100/external/login

Body

{
    "password": {{aes:password}},
    "username": "admin"
}

Example

  • Request

POST /external/login HTTP/1.1
Host: 192.168.1.100
Content-Length: 60

{
	"password": "{{aes:password}}",
	"username": "admin"
}
  • Response

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": {
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRUeXBlIjoiYXBpIiwiaXNEZXYiOmZhbHNlLCJhY2NvdW50IjoiQVBJQWRtaW4iLCJ0aW1lc3RhbXAiOjE3MjkwNjYxODgwNjh9._TiRw5pWTMypaJdbLBDjW61LEcpWJNv45TgxqP-5DVg",
        "freshToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjbGllbnRUeXBlIjoiYXBpIiwiZXhwIjoxNzMxNjU4MTg4LCJhY2NvdW50IjoiQVBJQWRtaW4ifQ.ZlRv11l58n7i_qSapHdVVwk7xFpIKJqnQfZ82osr6Lc",
        "expires": 900
    },
    "timestamp": 1729066188084
}

GET 查询分区组信息

http://192.168.1.100/external/group

Query Params

Name Description Schema

limit
optional

每页数量,可选,最小有效值为 1

integer (int32)

page
optional

分页数量,可选,最小有效值为 1

integer (int32)

Important
limit与page参数同时存在时,limit和page参数生效;否则返回全部结果。

Example

  • Request

GET /external/group HTTP/1.1
Host: 192.168.1.100
token: {{token}}
  • Repsonse

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": [
        {
            "id": 593613660340293,
            "name": "控制室"
        },
        {
            "id": 593613627748421,
            "name": "操场"
        },
        {
            "id": 593613527240773,
            "name": "所有教室"
        },
        {
            "id": 593613478428741,
            "name": "教室右"
        },
        {
            "id": 593613440966725,
            "name": "教室左"
        }
    ],
    "timestamp": 1729066209094,
    "totalCount": 5,
    "pageSize": 5,
    "currPage": 1,
    "totalPage": 1
}

GET 查询分区信息

http://192.168.1.100/external/zone

Query Params

Name Description Schema

limit
optional

每页数量,可选,最小有效值为 1

integer (int32)

page
optional

分页数量,可选,最小有效值为 1

integer (int32)

Important
limit与page参数同时存在时,limit和page参数生效;否则返回全部结果。

Example

  • Request

GET /external/zone HTTP/1.1
Host: 192.168.1.100
token: {{token}}
  • Repsonse

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": [
        {
            "id": "150-015-08394-20230320-00025",
            "name": "控制模块"
        },
        {
            "id": "150-015-08394-20230320-00074",
            "name": "音频模块"
        },
        {
            "id": "150-015-08394-20230330-00407",
            "name": "音箱左"
        },
        {
            "id": "150-015-08394-20230330-00449",
            "name": "音箱右"
        }
    ],
    "timestamp": 1729066216668,
    "totalCount": 4,
    "pageSize": 4,
    "currPage": 1,
    "totalPage": 1
}

GET 查询分区详情

http://192.168.1.100/external/zone/info?id={{DeviceId}}

Query Params

Name Description Schema

id
required

分区id,必选

integer (int32)

Example

  • Request

GET /external/zone/info?id={{DeviceId}} HTTP/1.1
Host: 192.168.1.100
token: {{token}}
  • Repsonse

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": {
        "fault": false,
        "busy": false,
        "volume": 50,
        "id": "150-015-08394-20230320-00025",
        "name": "控制模块"
    },
    "timestamp": 1729066226312
}

POST 设置分区音量

http://192.168.1.100/external/zone

Body

{
    "id": "{{DeviceId}}",
    "volume": 5
}

Example

  • Request

POST /external/zone HTTP/1.1
Host: 192.168.1.100
token: {{token}}
Content-Length: 48

{
    "id": "{{DeviceId}}",
    "volume": 5
}
  • Repsonse

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": null,
    "timestamp": 1729066235175
}

GET 查询预设任务

http://192.168.1.100/external/pretask

Query Params

Name Description Schema

limit
optional

每页数量,可选,最小有效值为 1

integer (int32)

page
optional

当前页码,可选,最小有效值为 1

integer (int32)

type
optional

任务类型,可选。

integer (int32)

Important
limit与page参数同时存在时,limit和page参数生效;否则返回全部结果。 任务类型:为空查询所有类型。0 - 紧急广播,1 - 预录语音,3 - 背景音乐

Example

  • Request

GET /external/pretask HTTP/1.1
Host: 192.168.1.100
token: {{token}}
  • Repsonse

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": [
        {
            "id": 593615036334149,
            "name": "音乐",
            "type": 3
        },
        {
            "id": 599239168102469,
            "name": "紧急",
            "type": 0
        },
        {
            "id": 593625131962437,
            "name": "眼保健操",
            "type": 3
        },
        {
            "id": 593614887272517,
            "name": "语音",
            "type": 1
        }
    ],
    "timestamp": 1729066242660,
    "totalCount": 4,
    "pageSize": 4,
    "currPage": 1,
    "totalPage": 1
}

POST 开始广播

http://192.168.1.100/external/task

Body

{
	"groups": [{{groupId}}],
	"id": {{taskid}}
}

Example

  • Request

POST /external/task HTTP/1.1
Host: 192.168.1.100
token: {{token}}
Content-Length: 50

{
	"groups": [{{groupId}}],
	"id": {{taskid}}
}
  • Repsonse

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": 601824726704197,
    "timestamp": 1729066266937
}

DELETE 停止广播

http://192.168.1.100/external/task

Body

{
	"id": {{taskdata}}
}

Example

  • Request

DELETE /external/task HTTP/1.1
Host: 192.168.1.100
token: {{token}}
Content-Length: 25

{
	"id": {{taskdata}}
}
  • Response

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": null,
    "timestamp": 1729066276385
}

POST 获取系统状态

http://192.168.1.100/external/status

Example

  • Request

POST /external/status HTTP/1.1
Host: 192.168.1.100
token: {{token}}
  • Repsonse

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": {
        "fault": false,
        "evac": false
    },
    "timestamp": 1729066284318
}

POST 刷新

http://192.168.1.100/external/refresh

Body

{
    "freshToken": "{{freshToken}}"
}

Example

  • Request

POST /external/refresh HTTP/1.1
Host: 192.168.1.100
token: {{token}}
Content-Length: 40

{
    "freshToken": "{{freshToken}}"
}
  • Response

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjbGllbnRUeXBlIjoiYXBpIiwiYWNjb3VudCI6IkFQSUFkbWluIn0.yIKA-vZqOMOWHjwn55RxIhzU2F3Mio9sJFX7XNt_9wg",
        "freshToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjbGllbnRUeXBlIjoiYXBpIiwiZXhwIjoxNzMxNjU4MjkzLCJhY2NvdW50IjoiQVBJQWRtaW4ifQ.lRnmIyBgnKF5jvqb6ALahX-7VY5rrKYAN-hZZ5i2Y90",
        "expires": 900
    },
    "timestamp": 1729066293220
}

DELETE 登出

http://192.168.1.100/external/logout

Example

  • Request

DELETE /external/logout HTTP/1.1
Host: 192.168.1.100
token: {{token}}
  • Response

{
    "successful": true,
    "code": 200,
    "msg": "Success",
    "data": null,
    "timestamp": 1729066301724
}