描述:以下是为开放平台后台服务的一组 API,我们可以将参数传递给 API 以控制开放平台后台节点。
服务地址:https://open.datastory.com.cn/api/v1(prd)
说明:Route 字面意思就是路由,通过定义一些规则来匹配客户端的请求,然后根据匹配结果加载并执行相应的插件,并把请求转发给到指定 Upstream。
方法 | 请求URI | 参数 | 请求体 | 描述 |
---|---|---|---|---|
POST | /routes | 无 | {...} | 创建路由,id 由后台服务自动生成 |
GET | /routes | name:String,路由名称 uri:String,路由路径 tag:String,路由所属标签 | 无 | 检索路由列表 |
GET | /routes/{id} | id:String,路由ID,必填 | 无 | 获取路由 |
PATCH | /routes/{id} | id:String,路由ID,必填 | {...} | 更新路由,修改已有 Route 的部分属性,其他不涉及的属性会原样保留 |
DELETE | /routes/{id} | id:String,路由ID,必填 | 无 | 删除路由 |
GET | /routes/{id}/whitelists | id:String,路由ID,必填 keyword:String,用于匹配凭证ID和名称 | 无 | 检索路由的授权凭证列表 |
GET | /routes/{id}/logs | id:String,路由ID,必填 uri:String,路由的路径 httpStatus:String,http状态码 | 无 | 检索路由日志,获取请求日志内容 |
GET | /monitoredStatistics | timeFrom:Integer,开始时间 timeTo:Integer,结束时间 routId:String,路由ID routeName:String,路由名称 consumerName:String,调用凭证名称 consumerId:String,调用凭证ID | 无 | 检索路由的监控统计数据,获得路由某个调用凭证的请求次数、响应时长等信息 |
创建路由 请求 body 示例:
{
"name": "string",
"labels": [
"string"
],
"description": "string",
"hosts": [
"string"
],
"uris": [
"string"
],
"methods": [
"GET"
],
"plugins": [
{
"name": "string",
"properties": "string"
}
],
"upstream": {
"id": "string",
"name": "string",
"description": "string",
"loadBalanceType": "CHASH",
"hashOn": "CONSUMER",
"hashKey": "string",
"nodes": [
{
"host": "string",
"port": "string",
"weight": 0
}
],
"hostHeader": "PASS",
"retryConf": {
"retryCount": 0,
"retryTimeout": 0
},
"scheme": "HTTP",
"timeoutConf": {
"connect": 0,
"send": 0,
"read": 0
},
"checkConf": {
"active": {
"type": "HTTP",
"timeout": 0,
"concurrency": 0,
"host": "string",
"port": "string",
"path": "string",
"headers": [
"string"
],
"healthy": {
"interval": 0,
"successCount": 0,
"httpStatuses": [
"string"
]
},
"unhealthy": {
"timeoutCount": 0,
"interval": 0,
"httpStatuses": [
"string"
],
"httpFailureCount": 0,
"tcpFailureCount": 0
}
},
"passive": {
"type": "HTTP",
"healthy": {
"successCount": 0,
"httpStatuses": [
"string"
]
},
"unhealthy": {
"timeoutCount": 0,
"httpStatuses": [
"string"
],
"httpFailureCount": 0,
"tcpFailureCount": 0
}
}
}
}
}
更新路由请求 body 示例:
{
"fieldMask": [
"name"
],
"route": {
"name": "string",
"labels": [
"string"
],
"description": "string",
"hosts": [
"string"
],
"uris": [
"string"
],
"methods": [
"GET"
],
"plugins": [
{
"name": "string",
"properties": "string"
}
],
"state": "OFFLINE",
"upstream": {
"id": "string",
"name": "string",
"description": "string",
"loadBalanceType": "CHASH",
"hashOn": "CONSUMER",
"hashKey": "string",
"nodes": [
{
"host": "string",
"port": "string",
"weight": 0
}
],
"hostHeader": "PASS",
"retryConf": {
"retryCount": 0,
"retryTimeout": 0
},
"scheme": "HTTP",
"timeoutConf": {
"connect": 0,
"send": 0,
"read": 0
},
"checkConf": {
"active": {
"type": "HTTP",
"timeout": 0,
"concurrency": 0,
"host": "string",
"port": "string",
"path": "string",
"headers": [
"string"
],
"healthy": {
"interval": 0,
"successCount": 0,
"httpStatuses": [
"string"
]
},
"unhealthy": {
"timeoutCount": 0,
"interval": 0,
"httpStatuses": [
"string"
],
"httpFailureCount": 0,
"tcpFailureCount": 0
}
},
"passive": {
"type": "HTTP",
"healthy": {
"successCount": 0,
"httpStatuses": [
"string"
]
},
"unhealthy": {
"timeoutCount": 0,
"httpStatuses": [
"string"
],
"httpFailureCount": 0,
"tcpFailureCount": 0
}
}
}
}
}
}
产品咨询
020-38061725
微信扫描二维码在线咨询