Logo
    立即注册
    开放平台
    产品文档
    主要接口
    最近更新时间:2022-08-12 14:08:48

    概述

    描述:以下是为开放平台后台服务的一组 API,我们可以将参数传递给 API 以控制开放平台后台节点。

    服务地址:https://open.datastory.com.cn/api/v1(prd)

    Route - 路由管理

    说明:Route 字面意思就是路由,通过定义一些规则来匹配客户端的请求,然后根据匹配结果加载并执行相应的插件,并把请求转发给到指定 Upstream。

    请求方式

    方法请求URI参数请求体描述
    POST/routes{...}创建路由,id 由后台服务自动生成
    GET/routesname: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}/whitelistsid:String,路由ID,必填
    keyword:String,用于匹配凭证ID和名称
    检索路由的授权凭证列表
    GET/routes/{id}/logsid:String,路由ID,必填
    uri:String,路由的路径
    httpStatus:String,http状态码
    检索路由日志,获取请求日志内容
    GET/monitoredStatisticstimeFrom:Integer,开始时间
    timeTo:Integer,结束时间
    routId:String,路由ID
    routeName:String,路由名称
    consumerName:String,调用凭证名称
    consumerId:String,调用凭证ID
    检索路由的监控统计数据,获得路由某个调用凭证的请求次数、响应时长等信息

    body 请求参数

    创建路由 请求 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
              }
            }
          }
        }
      }
    }

    微信扫描二维码在线咨询