REST API文档

高级配置-核心配置

核心配置

信息说明:

参数说明
name名称 必填
disabled是否启用,默认不启用 0 启动 1 不启用
description描述 非必填

参数说明:

参数说明
realmSWITCH-CONF-CLI-KEYBINDINGS 核心配置中CLI-KEYBINDINGS
k核心配置参数名
v核心配置参数值
ref_id核心配置id
id某个参数对应的id
disabled是否启用,默认启用 0 启动 1 不启用

获取核心配置信息

  • 请求 URL/api/switch_conf_profiles

  • 请求方式GET

  • Body 信息:无

  • 返回值:参考信息说明

  • curl 示例

curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/switch_conf_profiles
  • 返回值
[
  {
  "deleted_at":"",
  "created_at":"2024-07-10 02:53:14",
  "name":"switch_conf",
  "updated_at":"2024-07-10 02:53:14",
  "description":"default",
  "disabled":0,
  "id":1
  }
]

获取指定核心配置中参数信息

  • 请求 URL/api/switch_conf_profiles/$id

  • 请求方式GET

  • Body 信息:无

  • curl 示例

curl -XGET -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" 192.168.1.100:8081/api/switch_conf_profiles/1
  • 返回值
{
  "created_at": "2024-07-10 02:53:14",
  "name": "switch_conf",
  "id": 1,
  "deleted_at": "",
  "params": [
  {
    "id": "1891",
    "k": "1",
    "updated_at": "2024-07-10 02:53:14",
    "created_at": "2024-07-10 02:53:14",
    "ref_id": "1",
    "realm": "SWITCH-CONF-CLI-KEYBINDINGS",
    "deleted_at": "",
    "disabled": "0",
    "v": "help"
  },
  {
			...
	},
  {
    "id": "1903",
    "k": "G729",
    "updated_at": "2024-07-10 02:53:14",
    "created_at": "2024-07-10 02:53:14",
    "ref_id": "1",
    "realm": "SWITCH-CONF-DEFAULT-PTIMES",
    "deleted_at": "",
    "disabled": "1",
    "v": "40"
  },
  {
    "id": "1904",
    "k": "colorize-console",
    "updated_at": "2024-07-10 02:53:14",
    "created_at": "2024-07-10 02:53:14",
    "ref_id": "1",
    "realm": "SWITCH-CONF-SETTINGS",
    "deleted_at": "",
    "disabled": "0",
    "v": "true"
  },
  {
    ...
	},	
  {
    "id": "1973",
    "k": "test_key",
    "updated_at": "2024-07-10 02:53:14",
    "created_at": "2024-07-10 02:53:14",
    "ref_id": "1",
    "realm": "SWITCH-CONF-VARIABLES",
    "deleted_at": "",
    "disabled": "1",
    "v": "test_val"
  }
],
  "updated_at": "2024-07-10 02:53:14",
  "description": "default",
  "disabled": 0
}

创建核心配置

  • 请求 URL/api/switch_conf_profiles
  • 请求方式POST
  • Body 信息:参考开头许可证信息说明
{
  "name": "test",
  "template": "default"
}
  • curl 示例
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"name": "test","template": "default"}' \
-H "Content-Type: application/json" "http://192.168.1.100:8081/api/switch_conf_profiles"
  • 返回值
{
  "code": 200,
  "data": 2,
  "message": "success"
}

创建核心配置参数信息

  • 请求 URLapi/switch_conf_profiles/$id/params
  • 请求方式POST
  • Body 信息

添加 Channels 模块 license 例子

{
  "k": "test",
  "realm": "SWITCH-CONF-SETTINGS",
  "v": "1234"
}
  • curl 示例
curl -XPOST -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"channel":"100","conference": "30","emergency": "URGENT","expire": "2099-04-29","ivr": "30","module_license": "CHANNEL_LICENSE","register": "300","sps": "30","users": "300"}' \
-H "Content-Type: application/json" "http://192.168.1.100:8081/api/switch_conf_profiles/2/params"
  • 返回值
{
	"message": "success",
	"code": 200,
	"data": 3421
}

修改核心配置

  • 请求 URL/api/switch_conf_profiles/$id
  • 请求方式PUT
  • Body 信息
{
  "name": "new-test"
}
  • curl 示例
curl -XPUT -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" \
-H "Content-Type: application/json" \
-d '{"name": "new-test"}' \
"192.168.1.100:8081/api/switch_conf_profiles/3"
  • 返回值
{
  "code": 200,
  "data": "3",
  "message": "success"
}

修改指定核心配置的参数值

  • 请求 URL/api/switch_conf_profiles/$id/params/$param_id
  • 请求方式PUT
  • Body 信息:如下
参数说明
k参数名称
v参数值
{
  "v": "45678"
}
  • curl 示例
curl -H "X-XTRA-AUTH-ID: 69ee9c54-734b-11e7-a262-b5df20245f60" \
-d '{"v": "45678"}' \
-H "Content-Type: application/json" "http://192.168.1.100:8081/api/switch_conf_profiles/2/params/3420"
  • 返回值
{
  "message": "success",
  "data": "3420",
  "code": 200
}

删除核心配置的指定参数

  • 请求 URL/api/switch_conf_profiles/$id/params/$param_id

  • 请求方式DELETE

  • Body 信息:无

  • 示例

curl -0 -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE 192.168.1.100:8081/api/switch_conf_profiles/2/params/3420
  • 返回值
{
  "code": 200,
  "message": "success",
  "data": "3420"
}

删除核心配置

  • 请求 URL/api/switch_conf_profiles/$id

  • 请求方式DELETE

  • Body 信息:无

  • 示例

curl -0 -H "X-XTRA-AUTH-ID: 62dd0173-4916-4b1c-b958-546e4d7c91fe" -XDELETE 192.168.1.100:8081/api/switch_conf_profiles/2
  • 返回值
{
  "code": 200,
  "message": "success",
  "data": "2"
}
高级配置-许可证