OpenApi
上游
查询列表

查询详情

新增

{
"name": "jg_upstream",
"driver": "http",
"description": "通过postman添加上游",
"scheme": "HTTPS",
"retry":"1",
"timeout": 1000,
"nodes": [
"127.0.0.1:80 weight=1"
],
"balance": "round-robin",
"pass_host": "node"
}
修改
如果名称或者id不存在则创建
{
"driver": "http",
"description": "修改通过postman添加上游",
"scheme": "HTTPS",
"retry":"3",
"timeout": 2000,
"nodes": [
"127.0.0.2:80 weight=1"
],
"balance": "round-robin",
"pass_host": "node"
}
删除
根据名字或者id
应用
查询列表

查询详情

新增
{
"additional": [],
"anonymous": false,
"auth": [
{
"config": {
"expire": 0,
"password": "jg_app",
"username": "jg_app"
},
"position": "header",
"token_name": "Authorization",
"type": "basic",
"users": [
{
"expire": 0,
"hide_credential": false,
"pattern": {
"password": "jg_app",
"username": "jg_app"
}
}
]
}
],
"description": "postman新增应用",
"driver": "app",
"id": "jg_app@app",
"labels": {},
"name": "jg_app"
}
修改

{
"additional": [],
"anonymous": false,
"auth": [
{
"config": {
"expire": 0,
"password": "jg_app1",
"username": "jg_app1"
},
"position": "header",
"token_name": "Authorization",
"type": "basic",
"users": [
{
"expire": 0,
"hide_credential": false,
"pattern": {
"password": "jg_app1",
"username": "jg_app1"
}
}
]
}
],
"description": "修改postman新增应用",
"driver": "app",
"labels": {},
"name":"修改了名字"
}
删除

API
查询列表
http://172.30.4.85:9400/api/router

查询详情

新增
#当http请求同时满足以下条件时才能匹配这个路由
#method为GET或者POST
#请求头内host的值后缀为.com
#请求路径uri为/demo
#头部存在name这个key,且对应值不为空值
#请求参数里包含key为id,且值不为123
{
"name": "complex_router",
"driver": "http",
"description": "一个匹配规则较复杂的路由",
"listen": 8099,
"method": [
"GET",
"POST"
],
"location": "/demo",
"host": ["*.com"],
"rules": [
{
"type":"header",
"name":"user",
"value":"apinto"
}
],
"service": "anonymous_service@service",
"template": ""
}
Plugin:自定义的插件
proxy_rewrite:重定向

{
"description": "新增api",
"disable": false,
"driver": "http",
"host": [],
"listen": 0,
"location": "/jg/delete",
"method": [
"DELETE"
],
"name": "jg_api",
"plugins": {
"proxy_rewrite": {
"config": {
"headers": {},
"host_rewrite": false,
&nbs
OpenApi各模块操作及配置示例


最低0.47元/天 解锁文章
599

被折叠的 条评论
为什么被折叠?



