REST API文档
高级配置-系统管理
访问控制列表
信息说明如下:
参数 | 说明 |
---|---|
name | 名称 |
rule | 规则,允许(allow)或拒绝(deny) |
查看所有列表信息
请求 URL:
/api/acls
请求方式:
GET
Body 信息:无
curl 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" http://192.168.1.100:8081/api/acls
- 返回值:
{ "page": 1, "pageCount": 1, "data": [ { "rule": "deny", "updated_at": "2023-03-01 01:18:54", "deleted_at": "", "id": "1", "created_at": "2023-03-01 01:18:54", "name": "domains" } ], "rowCount": 1 }
查看指定访问控制列表的配置参数
请求 URL:
/api/acls/$id
请求方式:
GET
Body 信息:无
返回值:
curl 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" http://192.168.1.100:8081/api/acls/3
{ "created_at": "2023-03-03 02:19:11", "updated_at": "2023-03-03 02:19:11", "name": "test", "params": [ { "id": 2, "updated_at": "2023-03-03 02:19:33", "ports": "", "port_type": 0, "port": "3893", "k": "deny", "max_port": "", "acl_id": 3, "node_type": "cidr", "min_port": "", "v": "192.168.3.11", "created_at": "2023-03-03 02:19:33", "deleted_at": "" }, { "id": 3, "updated_at": "2023-03-03 02:19:56", "ports": "", "port_type": 2, "port": "", "k": "allow", "max_port": "2000", "acl_id": 3, "node_type": "cidr", "min_port": "1000", "v": "192.168.3.112", "created_at": "2023-03-03 02:19:56", "deleted_at": "" } ], "rule": "deny", "id": 3, "deleted_at": "" }
返回信息说明如下:
参数 | 说明 |
---|---|
acl_id | 控制列表 ID |
node_type | 数据类型,cidr 或 domain |
port_type | 端口类型 0: 单个端口(port) 1: 多个端口(ports) 2: 端口范围(min_port,max_port) |
port | 单个端口填写 |
ports | 多个端口填写比如 10000,10200 |
min_port | 最小端口比如 10000 |
max_port | 最大端口 20000 |
k | 参数规则,允许(allow)或拒绝(deny) |
v | 如果数据类型为 cidr,则值填 IP 地址+子网掩码或指定了端口范围则直接填 IP |
创建新的访问控制列表
- 请求 URL:
/api/acls
- 请求方式:
POST
- Body 信息:
参数 | 说明 |
---|---|
name | 名称 |
rule | 规则,允许(allow)或拒绝(deny) |
Body
{ "name": "xyt", "rule": "allow" }
- curl 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \ -d '{"name": "xyt","rule": "allow"}' \ -H "Content-Type: application/json" http://192.168.1.100:8081/api/acls
- 返回值:
{ "data": 2, "message": "success", "code": 200 }
修改指定访问控制列表
- 请求 URL:
/api/acls/$id
- 请求方式:
PUT
- Body 信息:
参数 | 说明 |
---|---|
name | 名称 |
rule | 规则,允许(allow)或拒绝(deny) |
{ "name": "test", "rule": "deny" }
- curl 示例:
curl -XPUT -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" \ -H "Content-Type: application/json" \ -d '{"name": "test", "rule":"deny"}' \ http://192.168.1.100:8081/api/acls/1
- 返回值:
{ "message": "success", "data": "1", "code": 200 }
创建控制列表的节点
- 请求 URL:
/api/acls/$id/nodes
- 请求方式:
POST
- Body 信息:
参数 | 说明 |
---|---|
node_type | 数据类型,cidr 或 domain |
port_type | 端口类型 0: 单个端口(port) 1: 多个端口(ports) 2: 端口范围(min_port,max_port) |
port | 单个端口填写 |
ports | 多个端口填写比如 10000,10200 |
min_port | 最小端口比如 10000 |
max_port | 最大端口 20000 |
k | 参数规则,允许(allow)或拒绝(deny) |
v | 如果数据类型为 cidr,则值填 IP 地址+子网掩码或指定了端口范围则直接填 IP |
{ "k": "deny", "node_type": "cidr", "v": "192.168.3.145/32" }
- curl 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \ -d '{"k": "deny","node_type": "cidr","v": "192.168.3.145/32"}' \ -H "Content-Type: application/json" http://192.168.1.100:8081/api/acls/2/nodes
- 返回值:
{ "code": 200, "message": "success", "data": 2 }
修改指定访问控制列表的参数配置
- 请求 URL:
/api/acls/$id/nodes/$node_id
- 请求方式:
PUT
- Body 信息:
{ "k": "allow", "node_type": "cidr", "v": "192.168.3.118/24" }
- curl 示例:
curl -XPUT -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" \ -H "Content-Type: application/json" \ -d '{"k": "allow", "node_type": "cidr","v": "192.168.3.118/24"}' \ http://192.168.1.100:8081/api/acls/1/nodes/2
- 返回值:
{ "data": "2", "message": "success", "code": 200 }
删除指定访问控制列表中某个参数
- 请求 URL:
/api/acls/$id/node/$node_id
- 请求方式:
DELETE
- Body 信息:无
- 返回值:
{ "id": "1" }
删除指定访问控制列表
请求 URL:
/api/acls/$id
请求方式:
DELETE
Body 信息:无
返回值:
curl 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE http://192.168.1.100:8081/api/acls/2
{ "id": "2" }
全局变量
参数 | 说明 |
---|---|
realm | 指定 GLOBAL,不可修改 |
k | 参数名 |
v | 参数值 |
disabled | 是否启动;0-是 1-否,不填默认是 |
查看全局变量
请求 URL:
/api/globals
请求方式:
GET
Body 信息:无
返回值:
curl 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/globals
{ "rowCount": 62, "page": 1, "pageCount": 2, "data": [ { "ref_id": 0, "realm": "GLOBAL", "created_at": "2022-05-16 09:51:32", "id": 891, "updated_at": "2022-05-16 09:51:32", "k": "video_mute_png", "deleted_at": "", "disabled": 0, "v": "$${images_dir}/default-mute.png" }, { "ref_id": 0, "realm": "GLOBAL", "created_at": "2022-05-16 09:51:32", "id": 892, "updated_at": "2022-05-16 09:51:32", "k": "video_no_avatar_png", "deleted_at": "", "disabled": 0, "v": "$${images_dir}/default-avatar.png" } ... ] }
新增全局变量
- 请求 URL:
/api/globals
- 请求方式:
POST
- Body 信息:
{ "k": "c", "v": "%(2000,4000,440,480)" }
- curl 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \ -d '{"k": "c","v": "%(2000,4000,440,480)"}' \ -H "Content-Type: application/json" http://192.168.1.100:8081/api/globals
- 返回值:
{ "data": 1753, "code": 200, "message": "success" }
修改全局变量某参数
- 请求 URL:
/api/globals/$id
- 请求方式:
PUT
- Body 信息:
{ "k": "ca-ring", "v": "%(2000,4000,440,480)" }
- curl 示例:
curl -XPUT -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" \ -H "Content-Type: application/json" \ -d '{"k": "ca-ring","v": "%(2000,4000,440,480)"}' \ http://192.168.1.100:8081/api/globals/1753
- 返回值:
{ "data": "1753", "message": "success", "code": 200 }
删除指定全局变量
请求 URL:
/api/globals/$id
请求方式:
DELETE
Body 信息:无
示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE http://192.168.1.100:8081/api/globals/1753
- 返回值:
{ "message": "success", "data": "1753", "code": 200 }
参数
参数 | 说明 |
---|---|
realm | 不同的模块对应的值不同,已初始化的数据不要轻易修改 |
k | 参数名 |
v | 参数值 |
disabled | 是否启动;0-是 1-否,不填默认是 |
查看所有系统参数
- 请求 URL:
/api/params/realm
- 请求方式:
GET
- Body 信息:无
- 返回值:
{ "data": [ { "realm": "cURL", "id": "1" }, { "realm": "XUNFEI-TTS", "id": "2" } ... ], "rowCount": 63, "page": 1, "pageCount": 2 }
- curl 示例:
curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/params/realm
查看指定域参数
- 请求 URL:
/api/params/realm/$realm
- 请求方式:
GET
- Body 信息:无
- 返回值:
{ "rowCount": 17, "pageCount": 1, "page": 1, "data": [ { "disabled": "0", "created_at": "2022-05-16 09:51:32", "v": "http://www.freeswitch.org/gateway.xml", "ref_id": "0", "deleted_at": "", "updated_at": "2022-05-16 09:51:32", "id": "210", "realm": "cURL", "k": "gateway-url" }, { "disabled": "0", "created_at": "2022-05-16 09:51:32", "v": "muser:mypass", "ref_id": "0", "deleted_at": "", "updated_at": "2022-05-16 09:51:32", "id": "211", "realm": "cURL", "k": "gateway-credentials" } ... ] }
- curl 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/params/realm/cURL
创建系统参数基本信息
- 请求 URL:
/api/params
- 请求方式:
POST
- Body 信息:
{ "disabled": 0, //默认开启 "k": "test11", //名称 "realm": "cURL", //域名称 "v": "123" //值 }
- curl 示例:
curl -POST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \ -d '{"disabled": 0,"k": "test11","realm": "cURL","v": "123"}' \ -H "Content-Type: application/json" http://192.168.1.100:8081/api/params
- 返回值:
{ "data": 1755, "message": "success", "code": 200 }
修改指定参数值
- 请求 URL:
/api/params/:id
- 请求方式:
PUT
- Body 信息:
{ "k": "test_t", //名称 "v": "300" //值 }
- curl 示例:
curl -XPUT -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" \ -H "Content-Type: application/json" \ -d '{"k": "test_t","v": "300"}' \ 192.168.1.100:8081/api/params/1755
- 返回值:
{ "code": 200, "message": "success", "data": "1755" }
删除指定参数
- 请求 URL:
/api/params/:id
- 请求方式:
DELETE
- Body 信息:无
- 返回值:
{ "message": "success", "code": 200, "data": "1755" }
示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE 192.168.1.100:8081/api/params/1755
分配器
分配器信息说明如下:
参数 | 说明 |
---|---|
name | 名称 |
total_weight | 总权重 |
获取分配器
请求 URL:
/api/distributors
返回所有分配器信息请求 URL:
/api/distributors/$id
返回指定 ID 的分配器信息请求方式:
GET
返回值: 路由 JSON 对象,如果找不到会返回 HTTP 状态码
404
。curl 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" http://192.168.1.100:8081/api/distributors
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/distributors/1
返回
{ "page": 1, "data": [ { "total_weight": "2", "name": "test", "updated_at": "2023-03-03 03:28:57", "created_at": "2023-03-03 03:28:57", "id": "1", "deleted_at": "" } ], "rowCount": 1, "pageCount": 1 }
新建分配器
- 请求 URL:
/api/distributors
- 请求方式:
POST
- 消息头:
Content-Type: application/json
- Body 信息: 参见分配器信息说明。
Body:
{ "name": "test", "total_weight": "10" }
返回:
{ "message": "success", "code": 200, "data": 1 }
- curl 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \ -d '{"name": "test","total_weight":"10"}' \ -H "Content-Type: application/json" "http://192.168.1.100:8081/api/distributors"
删除分配器
- 请求 URL:
/api/distributors/$id
- 请求方式:
DELETE
- 消息头: 无
- 返回值:
状态 | 返回值 |
---|---|
成功 | {"code": 200,"message": "success","data": "1"} |
失败 | 404 |
- 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE http://192.168.1.100:8081/api/distributors/1
返回:
{ "data": "1", "code": 200, "message": "success" }
修改分配器
请求 URL:
/api/distributors/$id
请求方式:
PUT
消息头:
Content-Type: application/json
Body 信息: 参见分配器信息说明。
示例:
Body:
{ "name": "test", "total_weight": "5" }
返回:
{ "data": "1", "code": 200, "message": "success" }
- curl 示例:
curl -XPUT -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" \ -H "Content-Type: application/json" \ -d '{"name":"test","description": "test"}' \ "http://192.168.1.100:8081/api/distributors/1"
新建节点
- 请求 URL:
/api/distributors/$id/nodes
- 请求方式:
POST
- 消息头:
Content-Type: application/json
- Body 信息: 参见分配器信息说明。
Body:
{ "k": "gw", "v": "2" }
返回:
{ "message": "success", "data": 1, "code": 200 }
- curl 示例:
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \ -d '{"k": "gw","v":"2"}' \ -H "Content-Type: application/json" "http://192.168.1.100:8081/api/distributors/1/nodes"
修改分配器
请求 URL:
/api/distributors/id/nodes/$id
请求方式:
PUT
消息头:
Content-Type: application/json
Body 信息: 参见分配器信息说明。
示例:
Body:
{ "k": "test", "v": "test" }
返回:
{ "data": "2", "message": "success", "code": 200 }
- curl 示例:
curl -XPUT -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" \ -H "Content-Type: application/json" \ -d '{"k":"test","v": "test"}' \ "http://192.168.1.100:8081/api/distributors/2/nodes/2"
删除分配器指定节点
请求 URL:
/api/distributors/nodes/$id
请求方式:
DELETE
消息头: 无
返回值:
示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE http://192.168.1.100:8081/api/distributors/nodes/1
返回:
{ "data": "1", "message": "success", "code": 200 }
脚本
脚本信息说明如下:
参数 | 说明 |
---|---|
v | 脚本运行路径 |
status | 脚本运行状态 |
disabled | 是否启用 0 启用 1 禁用 |
param | 脚本名 |
获取脚本信息
请求 URL:
api/script_lists?type=0
返回所有系统脚本信息请求 URL:
api/script_lists?type=1
返回所有功能脚本信息请求方式:
GET
返回值: 路由 JSON 对象,如果找不到会返回 HTTP 状态码
404
。curl 示例:
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" http://192.168.1.100:8081/api/script_lists?type=0
curl -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/script_lists?type=1
返回
{ "rowCount": 8, "page": 1, "data": [ { "ref_id": "", "id": "812", "v": "xui/xlonglive/auto_call_task.lua", "deleted_at": "", "realm": "API_ON_STARTUP", "created_at": "2023-03-01 01:18:57", "disabled": "1", "updated_at": "2023-03-01 01:18:57", "log_disabled": 1, "param": "auto-call-task", "k": "luarun", "status": "stop" }, { "ref_id": "", "id": "811", "v": "xui/xlonglive/conference_auto_dial.lua", "deleted_at": "", "realm": "API_ON_STARTUP", "created_at": "2023-03-01 01:18:57", "disabled": "1", "updated_at": "2023-03-01 01:18:57", "log_disabled": 1, "param": "conference_auto_dial", "k": "luarun", "status": "stop" }, { "ref_id": "", "id": "809", "v": "xui/xlonglive/sip_trace.lua", "deleted_at": "", "realm": "API_ON_STARTUP", "created_at": "2023-03-01 01:18:57", "disabled": "1", "updated_at": "2023-03-01 01:18:57", "log_disabled": 1, "param": "sip-trace", "k": "luarun", "status": "stop" }, { "ref_id": "", "id": "808", "v": "xui/xlonglive/switch-rrd.lua", "deleted_at": "", "realm": "API_ON_STARTUP", "created_at": "2023-03-01 01:18:57", "disabled": "0", "updated_at": "2023-03-01 01:18:57", "log_disabled": 1, "param": "rrd", "k": "luarun", "status": "stop" }, { "ref_id": "", "id": "807", "v": "xui/xlonglive/heartbeat.lua", "deleted_at": "", "realm": "API_ON_STARTUP", "created_at": "2023-03-01 01:18:57", "disabled": "0", "updated_at": "2023-03-01 01:18:57", "log_disabled": 1, "param": "heartbeat", "k": "luarun", "status": "stop" }, { "ref_id": "", "id": "806", "v": "xui/xlonglive/conference_manager_cdr.lua", "deleted_at": "", "realm": "API_ON_STARTUP", "created_at": "2023-03-01 01:18:57", "disabled": "0", "updated_at": "2023-03-01 01:18:57", "log_disabled": 1, "param": "conference-manager-cdr", "k": "luarun", "status": "stop" }, { "ref_id": "", "id": "805", "v": "xui/xlonglive/conference_manager.lua", "deleted_at": "", "realm": "API_ON_STARTUP", "created_at": "2023-03-01 01:18:57", "disabled": "0", "updated_at": "2023-03-01 01:18:57", "log_disabled": 1, "param": "conference-manager", "k": "luarun", "status": "running" }, { "ref_id": "", "id": "804", "v": "xui/xlonglive/shutdown.lua", "deleted_at": "", "realm": "API_ON_STARTUP", "disabled": "0", "created_at": "2023-03-01 01:18:57", "log_disabled": 1, "updated_at": "2023-03-01 01:18:57", "k": "luarun", "status": "stop" } ], "pageCount": 1 }