应用列表
创建 HTTP 应用
URI
POST /admin-api/applications/http
请求示例
Shell
curl 'http://{admin-site}/admin-api/applications/http' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{
"partitions":[ // 应用所属分区
1
],
"is_default":false, // 是否默认应用
"http_ports":[ // 监听端口
80
],
"https_ports":[
443
],
"http2_status":"global", // 支持 1."global": 使用全局配置 2."disabled": 禁用 3."enabled": 启用
"allow_access_by_ip_list":["11.11.11.11"], // 使用ip地址加载证书
"allow_load_by_ip_list":[], // 使用ip地址加载应用
"domains":[
{
"is_wildcard":false, // 是否通配符
"domain":"www.openresty.com"
}
],
"name": "openresty" // 标签
}'
响应示例
Status: 200 OK
{
"status":0,
"data":{
"id":42 // app id
}
}
创建 TLS 应用
URI
POST /admin-api/applications/tls
请求示例
Shell
curl 'http://{admin-site}/admin-api/applications/tls' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{
"partitions":[ // 应用所属分区
1
],
"is_default":false, // 是否默认应用
"http_ports":[ // 监听端口
80
],
"https_ports":[
443
],
"http2_status":"global", // 支持 1."global": 使用全局配置 2."disabled": 禁用 3."enabled": 启用
"allow_access_by_ip_list":["11.11.11.11"], // 使用ip地址加载证书
"allow_load_by_ip_list":[], // 使用ip地址加载应用
"domains":[
"www.openresty.com"
],
"name": "openresty" // 标签
}'
响应示例
Status: 200 OK
{
"status":0,
"data":{
"id":42 // app id
}
}
创建 TCP 应用
URI
POST /admin-api/applications/tcp
请求示例
Shell
curl 'http://{admin-site}/admin-api/applications/tcp' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{
"tcp_ports":[
86
]
"partitions":[ // 应用所属分区
1
],
"is_default":false, // 是否默认应用
"http_ports":[ // 监听端口
80
],
"https_ports":[
443
],
"http2_status":"global", // 支持 1."global": 使用全局配置 2."disabled": 禁用 3."enabled": 启用
"allow_access_by_ip_list":["11.11.11.11"], // 使用ip地址加载证书
"allow_load_by_ip_list":[], // 使用ip地址加载应用
"label": "openresty" // 标签
}'
响应示例
Status: 200 OK
{
"status":0,
"data":{
"id":42 // app id
}
}
删除 HTTP 应用
URI
DELETE /admin-api/applications/http/{app-id}
请求示例
Shell
curl 'http://{admin-site}/admin-api/applications/http/42' -X 'DELETE'
响应示例
Status: 200 OK
{
"status":0
}
删除 TLS 应用
URI
DELETE /admin-api/applications/tls/{app-id}
请求示例
Shell
curl 'http://{admin-site}/admin-api/applications/tls/42' -X 'DELETE'
响应示例
Status: 200 OK
{
"status":0
}
删除 TCP 应用
简介
删除 TCP 应用
URI
DELETE /admin-api/applications/tcp/{app-id}
请求示例
Shell
curl 'http://{admin-site}/admin-api/applications/tcp/42' -X 'DELETE'
响应示例
Status: 200 OK
{
"status":0
}
获取 HTTP/TLS/TCP 应用列表
URI
GET /admin-api/applications
URI 参数
detail
type: integer
is_necessary: no
description: 传任意值显示详细信息,不传显示简略信息
partition_id
type: integer
required: no
description: 集群分区id
start_time
type: integer
required: no
description: 创建时间起点,时间戳,为 0 表示无限制
end_time
type: integer
required: no
description: 创建时间终点,时间戳,为 0 表示无限制
page
type: integer
required: no
description: 第几页 (default 1)
page_size
type: integer
required: no
description: 每页大小 (default 20)
请求示例
Shell
curl 'http://{admin-site}/admin-api/applications?detail=1&partition_id=1&start_time=0&end_time=0&page=1&page_size=20'
响应示例
Status: 200 OK
{
"status":0,
"data":{
"meta":{
"count":7
},
"data":[
{
"partitions":[
1
],
"id":4,
"domains":[
"www.openresty.com"
],
"_created_unix":1615442119.4638,
"creator":1,
"_modified_unix":1615442119.4638,
"pending_changes":0,
"type":"tls"
},
{
"partitions":[
1
],
"creator":1,
"pending_changes":0,
"label":"openresty",
"id":3,
"_created_unix":1615441984.9297,
"type":"tcp",
"_modified_unix":1615441984.9297,
"tcp_ports":[
86
]
},
{
"partitions":[
1
],
"offline":{
"enabled":false
},
"creator":1,
"http_ports":[
80
],
"pending_changes":3,
"type":"http",
"is_default":false,
"_modified_unix":1615440009.7412,
"domains":[
{
"is_wildcard":false,
"domain":"www.openresty.com",
"id":42
}
],
"id":42,
"allow_access_by_ip_list":[
"11.22.33.44"
],
"https_ports":[
443
],
"http2_status":"disabled",
"_created_unix":1615437907.3928
},
]
},
"time":1615443068
}
搜索 HTTP 应用
URI
GET /admin-api/search/http
URI参数
partition_id
type: integer
required: no
description: 集群分区id
domain
type: string
required: no
description: 待搜索的域名
start_time
type: integer
required: no
description: 创建时间起点,时间戳,为 0 表示无限制
end_time
type: integer
required: no
description: 创建时间终点,时间戳,为 0 表示无限制
page
type: integer
required: no
description: 第几页 (default 1)
page_size
type: integer
required: no
description: 每页大小 (default 20)
请求示例
Shell
curl 'http://{admin-site}/admin-api/search/http?page=1&page_size=20&partition_id=1&start_time=0&end_time=0&domain=openresty'
响应示例
Status: 200 OK
{
"status":0,
"data":{
"meta":{
"count":4
},
"data":[
{
"partitions":[
1
],
"offline":{
"enabled":false
},
"creator":1,
"http_ports":[
80
],
"is_default":false,
"_created_unix":1615286153.3308,
"_modified_unix":1615286293.5563,
"domains":[
{
"is_wildcard":false,
"domain":"www.openresty.com",
"id":3
}
],
"id":3,
"pending_changes":2,
"http2_status":"global",
"type":"http"
}
]
},
"time":1615443784
}
获取未发布的 HTTP/TLS/TCP 应用列表
URI
GET /admin-api/search/pending-app
URI参数
partition_id
type: integer
required: no
description: 集群分区id
start_time
type: integer
required: no
description: 创建时间起点,时间戳,为 0 表示无限制
end_time
type: integer
required: no
description: 创建时间终点,时间戳,为 0 表示无限制
page
type: integer
required: no
description: 第几页 (default 1)
page_size
type: integer
required: no
description: 每页大小 (default 20)
请求示例
Shell
curl 'http://{admin-site}/admin-api/search/pending-app?page=1&page_size=20&partition_id=1&start_time=0&end_time=0'
响应示例
Status: 200 OK
{
"status":0,
"data":{
"meta":{
"count":3
},
"data":[
{
"partitions":[
1
],
"offline":{
"enabled":false
},
"_modified_unix":1615440009.7412,
"_created_unix":1615437907.3928,
"creator":1,
"http_ports":[
80
],
"pending_changes":3,
"type":"http",
"id":42,
"is_default":false,
"allow_access_by_ip_list":[
"11.22.33.44"
],
"domains":[
{
"is_wildcard":false,
"domain":"www.openresty.com",
"id":42
}
],
"http2_status":"disabled",
"https_ports":[
443
]
}
]
},
"time":1615443288
}