更新时间:2023-02-27 GMT+08:00
分享

查询API列表

功能介绍

查看API列表,返回API详细信息、发布信息等,但不能查看到后端服务信息。

URI

HTTP/HTTPS请求方法以及URI如下表所示。

表1 HTTP/HTTPS请求方法以及URI

请求方法

URI

GET

/v1/{project_id}/apigw/instances/{instance_id}/apis[?page_size, page_no, id, name, group_id, req_protocol, req_method, req_uri, auth_type, env_id, type,status, tags]

  • 可以在URI后面用‘?’和‘&’添加不同的查询条件组合。
  • 查询条件可为以下字段以及对应的值:id、name、group_id、req_protocol、req_method、req_uri、auth_type、env_id、type、status、tags、page_size、page_no。

请求消息

表2 参数说明

名称

是否必选

类型

说明

project_id

String

项目ID。可从控制台“我的凭证”中获取region下项目ID,管理员权限可查询。

instance_id

String

实例ID,可从API网关控制台的专享版实例信息中获取。

id

String

API的编号

name

String

API的名称

group_id

String

API所属分组编号

req_protocol

String

请求协议

req_method

String

请求方法

req_uri

String

请求路径

auth_type

String

授权类型

env_id

String

发布的环境编号

type

Integer

API类型

tags

String

标签

page_size

Integer

每页显示的条数,默认值:20,最大值500。page_size值为0时,返回所有API。

page_no

Integer

页码,默认值:1

precise_search

String

指定需要精确匹配查找的参数名称,目前仅支持name、req_uri

响应消息

表3 参数说明

名称

类型

说明

total

Integer

符合条件的API总数

size

Integer

本次查询返回的列表长度

apis

字典数据类型

本次查询到的API列表

表4 apis参数说明

参数

类型

说明

id

String

API编号

name

String

API名称

group_id

String

API所属分组的编号

group_name

String

API所属分组的名称

status

Integer

API的状态

type

Integer

API类型

version

String

API版本

req_protocol

String

API访问协议

req_method

String

API请求方式

req_uri

String

API访问地址

auth_type

String

API认证方式

auth_opt

字段数据类型

API认证方式参数

authorizer_id

String

前端自定义认证对象的ID

match_mode

String

API匹配方式

register_time

Timestamp

API创建时间

update_time

Timestamp

API修改时间

remark

String

API描述

bakend_type

String

后端类型

run_env_name

String

发布的环境名

run_env_id

String

发布的环境id

publish_id

String

发布记录的编号

arrange_necessary

Integer

是否需要编排

cors

Bool

是否支持跨域访问

tag

String

服务名称标签,待废弃字段

tags

[]String

标签

表5 auth_opt参数说明

参数

类型

说明

app_code_auth_type

String

AppCode简易认证类型

响应消息样例:

{
  "total": 3,
  "size": 3,
  "apis": [
    {
      "name": "test",
      "type": 1,
      "version": "V0.0.1",
      "req_protocol": "HTTPS",
      "req_method": "GET",
      "req_uri": "/test/{project_id}",
      "auth_type": "APP",
      "auth_opt": {
        "app_code_auth_type": "DISABLE"
      },
      "tags": ["APIG-SN-test", "test"],
      "cors": false,
      "match_mode": "NORMAL",
      "backend_type": "HTTP",
      "group_id": "f71f69876f90456ca6fd18ed012fdc11",
      "id": "81efcfd94b8747a0b21e8c04144a4e8c",
      "status": 1,
      "arrange_necessary": 2,
      "register_time": "2018-08-15T03:41:11Z",
      "update_time": "2018-08-15T03:41:11Z",
      "group_name": "group0002"
    },
    {
      "name": "bbbbb",
      "type": 1,
      "version": "0.0.1",
      "req_protocol": "HTTPS",
      "req_method": "GET",
      "req_uri": "/test002",
      "auth_type": "APP",
      "auth_opt": {
        "app_code_auth_type": "DISABLE"
      },
      "tags": ["APIG-SN-test", "test"],
      "cors": false,
      "match_mode": "NORMAL",
      "backend_type": "MOCK",
      "remark": "aaa",
      "group_id": "70f1b578da9b4dfe889b4c33d1b995c2",
      "id": "91c26288acea4448be205265d77dae22",
      "status": 1,
      "arrange_necessary": 2,
      "register_time": "2018-07-27T11:54:24Z",
      "update_time": "2018-07-27T11:54:24Z",
      "group_name": "test001",
      "run_env_name": "RELEASE",
      "run_env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
      "publish_id": "a6e06a00c382436eb524fa2dd343cb6d"
    },
    {
      "name": "aaa",
      "type": 1,
      "version": "0.0.1",
      "req_protocol": "HTTPS",
      "req_method": "GET",
      "req_uri": "/test001",
      "auth_type": "APP",
      "auth_opt": {
        "app_code_auth_type": "DISABLE"
      },
      "tags": ["APIG-SN-test", "test"],
      "cors": false,
      "match_mode": "NORMAL",
      "backend_type": "MOCK",
      "remark": "aaa",
      "group_id": "70f1b578da9b4dfe889b4c33d1b995c2",
      "id": "aebacac6095942b4b2dd2b209bb7b9bc",
      "status": 1,
      "arrange_necessary": 2,
      "register_time": "2018-07-27T11:23:34Z",
      "update_time": "2018-07-27T11:23:34Z",
      "group_name": "test001",
      "run_env_name": "RELEASE",
      "run_env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
      "publish_id": "1bc8b2b741a04bd4af3ef9d7cd003104"
    }
  ]
}

状态码

表6 返回消息说明

状态码

说明

200

OK

400

Bad Request

401

Unauthorized

500

Server Internal Error

分享:

    相关文档

    相关产品