查询API列表
功能介绍
查看API列表,返回API详细信息、发布信息等,但不能查看到后端服务信息和API请求参数信息
调用方法
请参见如何调用API。
URI
GET /v2/{project_id}/apigw/instances/{instance_id}/apis
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| project_id | 是 | String | 项目ID,获取方式请参见获取项目ID。 |
| instance_id | 是 | String | 实例ID,在API网关控制台的“实例信息”中获取。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| offset | 否 | Long | 偏移量,表示从此偏移量开始查询,偏移量小于0时,自动转换为0 缺省值:0 |
| limit | 否 | Integer | 每页显示的条目数量,条目数量小于等于0时,自动转换为20,条目数量大于500时,自动转换为500 最小值:1 最大值:500 缺省值:20 |
| 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类型 |
| precise_search | 否 | String | 指定需要精确匹配查找的参数名称,目前仅支持name、req_uri |
| vpc_channel_name | 否 | String | 负载通道名称 |
| return_data_mode | 否 | String | 指定API详情中需要包含的额外返回结果,多个参数之间使用“,”隔开,当brief和其他include参数共同使用时,brief不生效。 目前仅支持brief,include_group,include_group_backend。 brief:默认值,不包含额外信息。 include_group:返回结果中包含api_group_info。 include_group_backend:返回结果中包含backend_api。 缺省值:brief |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| X-Auth-Token | 是 | String | 用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
响应参数
状态码: 200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| size | Integer | 本次返回的列表长度 |
| total | Long | 满足条件的记录数 |
| apis | Array of ApiInfoPerPage objects | 本次查询到的API列表 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| name | String | API名称。 支持汉字、英文、数字、中划线、下划线、点、斜杠、中英文格式下的小括号和冒号、中文格式下的顿号,且只能以英文、汉字和数字开头,3-255个字符。 说明: 中文字符必须为UTF-8或者unicode编码。 |
| type | Integer | API类型
枚举值:
|
| version | String | API的版本 最大长度:16 |
| req_protocol | String | API的请求协议
缺省值:HTTPS 枚举值:
|
| req_method | String | API的请求方式,当API的请求协议为GRPC类型协议时请求方式固定为POST。 枚举值:
|
| req_uri | String | 请求地址。可以包含请求参数,用{}标识,比如/getUserInfo/{userId},支持 * / %- _ . 等特殊字符,总长度不超过512,且满足URI规范。 说明: 需要服从URI规范。 |
| auth_type | String | API的认证方式
当API的请求协议为GRPC类型时不支持自定义认证。 枚举值:
|
| auth_opt | AuthOpt object | 认证方式参数 |
| cors | Boolean | 是否支持跨域
缺省值:false 枚举值:
|
| match_mode | String | API的匹配方式
枚举值:
|
| backend_type | String | 后端类型
枚举值:
|
| remark | String | API描述。字符长度不超过255 说明: 中文字符必须为UTF-8或者unicode编码。 |
| group_id | String | API所属的分组编号 |
| body_remark | String | API请求体描述,可以是请求体示例、媒体类型、参数等信息。字符长度不超过20480 说明: 中文字符必须为UTF-8或者unicode编码。 |
| result_normal_sample | String | 正常响应示例,描述API的正常返回信息。字符长度不超过20480 说明: 中文字符必须为UTF-8或者unicode编码。 当API的请求协议为GRPC类型时不支持配置。 |
| result_failure_sample | String | 失败返回示例,描述API的异常返回信息。字符长度不超过20480 说明: 中文字符必须为UTF-8或者unicode编码。 当API的请求协议为GRPC类型时不支持配置。 |
| authorizer_id | String | 前端自定义认证对象的ID,API请求协议为GRPC类型时不支持前端自定义认证 |
| tags | Array of strings | 标签。 支持英文,数字,中文,特殊符号(-*#%.:_),且只能以中文或英文开头。 默认支持10个标签,如需扩大配额请联系技术工程师修改API_TAG_NUM_LIMIT配置。 最小长度:1 最大长度:128 |
| response_id | String | 分组自定义响应ID |
| roma_app_id | String | 集成应用ID 暂不支持 |
| domain_name | String | API绑定的自定义域名 暂不支持 |
| tag | String | 标签 待废弃,优先使用tags字段 |
| content_type | String | 请求内容格式类型: application/json application/xml multipart/form-data text/plain 暂不支持 枚举值:
|
| id | String | API编号 |
| status | Integer | API状态
|
| arrange_necessary | Integer | 是否需要编排 |
| register_time | String | API注册时间 |
| update_time | String | API修改时间 |
| group_name | String | API所属分组的名称 |
| group_version | String | API所属分组的版本 默认V1,其他版本暂不支持 缺省值:V1 |
| run_env_id | String | 发布的环境编号 存在多个发布记录时,环境编号之间用|隔开 |
| run_env_name | String | 发布的环境名称 存在多个发布记录时,环境名称之间用|隔开 |
| publish_id | String | 发布记录编号 存在多个发布记录时,发布记录编号之间用|隔开 |
| publish_time | String | 发布时间 存在多个发布记录时,发布时间之间用|隔开 |
| roma_app_name | String | API归属的集成应用名称 暂不支持 |
| ld_api_id | String | 当API的后端为自定义后端时,对应的自定义后端API编号 暂不支持 |
| backend_api | BackendApi object | 后端信息 |
| api_group_info | ApiGroupCommonInfo object | api分组信息 |
| req_params | Array of ReqParam objects | API的请求参数列表 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| app_code_auth_type | String | AppCode简易认证类型,仅在auth_type为APP时生效,默认为DISABLE:
缺省值:DISABLE 枚举值:
|
| 参数 | 参数类型 | 描述 |
|---|---|---|
| authorizer_id | String | 后端自定义认证对象的ID,后端类型为GRPC时不支持后端自定义认证 |
| url_domain | String | 后端服务的地址。 由主机(IP或域名)和端口号组成,总长度不超过255。格式为主机:端口(如:apig.example.com:7443)。如果不写端口,则HTTPS默认端口号为443,HTTP默认端口号为80。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、下划线、中划线组成,且只能以英文开头 |
| req_protocol | String | 请求协议,后端类型为GRPC时请求协议可选GRPCS 枚举值:
|
| remark | String | 描述。字符长度不超过255 说明: 中文字符必须为UTF-8或者unicode编码。 |
| req_method | String | 请求方式,后端类型为GRPC时请求方式固定为POST 枚举值:
|
| version | String | web后端版本,字符长度不超过16 |
| req_uri | String | 请求地址。可以包含请求参数,用{}标识,比如/getUserInfo/{userId},支持 * / %- _ . 等特殊字符,总长度不超过512,且满足URI规范。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、中划线、下划线组成,且只能以英文开头。 说明: 需要服从URI规范。 后端类型为GRPC时请求地址固定为/ |
| timeout | Integer | API网关请求后端服务的超时时间。最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000。 单位:毫秒。 最小值:1 |
| enable_client_ssl | Boolean | 是否开启双向认证 |
| retry_count | String | 请求后端服务的重试次数,默认为-1,范围[-1,10]。 当该值为-1时,幂等的接口会重试1次,非幂等的不会重试。POST,PATCH方法为非幂等;GET,HEAD,PUT,OPTIONS和DELETE等方法为幂等的。 缺省值:-1 |
| id | String | 编号 |
| status | Integer | 后端状态
|
| register_time | String | 注册时间 |
| update_time | String | 修改时间 |
| vpc_channel_info | VpcInfo object | VPC通道详情。如果vpc_channel_status = 1,则这个object类型为必填信息 |
| vpc_channel_status | Integer | 是否使用VPC通道
|
| 参数 | 参数类型 | 描述 |
|---|---|---|
| ecs_id | String | 云服务器ID |
| ecs_name | String | 云服务器名称 |
| cascade_flag | Boolean | 是否使用级联方式 暂不支持 |
| vpc_channel_proxy_host | String | 代理主机 |
| vpc_channel_id | String | VPC通道编号 |
| vpc_channel_port | Integer | VPC通道端口 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | 编号 |
| name | String | API分组名称 |
| status | Integer | 状态
枚举值:
|
| sl_domain | String | 系统默认分配的子域名 |
| register_time | String | 创建时间 |
| update_time | String | 最近修改时间 |
| on_sell_status | Integer | 是否已上架云商店:
暂不支持 |
| url_domains | Array of UrlDomain objects | 分组上绑定的独立域名列表 |
| sl_domain_access_enabled | Boolean | 调试域名是否可以访问,true表示可以访问,false表示禁止访问 缺省值:true |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | 域名编号 |
| domain | String | 访问域名 |
| cname_status | Integer | 域名cname状态:
|
| ssl_id | String | SSL证书编号 |
| ssl_name | String | SSL证书名称 |
| min_ssl_version | String | 最小ssl协议版本号。支持TLSv1.1或TLSv1.2 缺省值:TLSv1.1 枚举值:
|
| verified_client_certificate_enabled | Boolean | 是否开启客户端证书校验。只有绑定证书时,该参数才生效。当绑定证书存在trusted_root_ca时,默认开启;当绑定证书不存在trusted_root_ca时,默认关闭。 缺省值:false |
| is_has_trusted_root_ca | Boolean | 是否存在信任的根证书CA。当绑定证书存在trusted_root_ca时为true。 缺省值:false |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| name | String | 参数名称。 长度为1 ~ 32位的字符串,字符串由英文字母、数字、中划线、下划线、英文句号组成,且只能以英文开头。 |
| type | String | 参数类型 枚举值:
|
| location | String | 参数位置 枚举值:
|
| default_value | String | 参数默认值 |
| sample_value | String | 参数示例值 |
| required | Integer | 是否必须
location为PATH时,required默认为1,其他场景required默认为2 枚举值:
|
| valid_enable | Integer | 是否开启校验
缺省值:2 枚举值:
|
| remark | String | 描述信息。长度不超过255个字符 说明: 中文字符必须为UTF-8或者unicode编码。 |
| enumerations | String | 参数枚举值 |
| min_num | Integer | 参数最小值 参数类型为NUMBER时有效 |
| max_num | Integer | 参数最大值 参数类型为NUMBER时有效 |
| min_size | Integer | 参数最小长度 参数类型为STRING时有效 |
| max_size | Integer | 参数最大长度 参数类型为STRING时有效 |
| regular | String | 正则校验规则 暂不支持 |
| json_schema | String | JSON校验规则 暂不支持 |
| pass_through | Integer | 是否透传
枚举值:
|
| id | String | 参数编号 |
状态码: 400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码 |
| error_msg | String | 错误描述 |
状态码: 401
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码 |
| error_msg | String | 错误描述 |
状态码: 403
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码 |
| error_msg | String | 错误描述 |
状态码: 500
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码 |
| error_msg | String | 错误描述 |
请求示例
无
响应示例
状态码: 200
OK
{
"total" : 3,
"size" : 3,
"apis" : [ {
"arrange_necessary" : 2,
"id" : "5f918d104dc84480a75166ba99efff21",
"tags" : [ "webApi" ],
"backend_type" : "HTTP",
"auth_type" : "AUTHORIZER",
"auth_opt" : {
"app_code_auth_type" : "DISABLE"
},
"authorizer_id" : "8d0443832a194eaa84244e0c1c1912ac",
"cors" : false,
"status" : 1,
"group_name" : "api_group_001",
"group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
"group_version" : "V1",
"match_mode" : "NORMAL",
"name" : "Api_http",
"req_protocol" : "HTTPS",
"req_method" : "GET",
"req_uri" : "/test/http",
"type" : 1,
"version" : "V0.0.1",
"register_time" : "2020-07-31T12:42:51Z",
"update_time" : "2020-08-02T16:32:47.046289Z",
"remark" : "Web backend API"
}, {
"id" : "3a955b791bd24b1c9cd94c745f8d1aad",
"group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
"group_name" : "api_group_001",
"group_version" : "V1",
"match_mode" : "SWA",
"name" : "Api_mock",
"auth_type" : "IAM",
"auth_opt" : {
"auth_code_auth_type" : "DISABLE"
},
"backend_type" : "MOCK",
"cors" : false,
"req_protocol" : "HTTPS",
"req_uri" : "/test/mock",
"remark" : "Mock backend API",
"type" : 1,
"version" : "V0.0.1",
"req_method" : "GET",
"result_normal_sample" : "Example success response",
"result_failure_sample" : "Example failure response",
"tags" : [ "mockApi" ],
"register_time" : "2020-08-02T15:56:52Z",
"update_time" : "2020-08-02T15:56:52Z",
"status" : 1
}, {
"id" : "abd9c4b2ff974888b0ba79be7e6b2763",
"arrange_necessary" : 2,
"group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
"group_name" : "api_group_001",
"group_version" : "V1",
"match_mode" : "NORMAL",
"name" : "Api_function",
"auth_type" : "APP",
"auth_opt" : {
"auth_code_auth_type" : "DISABLE"
},
"backend_type" : "FUNCTION",
"cors" : false,
"req_protocol" : "HTTPS",
"req_uri" : "/test/function",
"remark" : "FunctionGraph backend API",
"type" : 1,
"version" : "V0.0.1",
"status" : 1,
"req_method" : "GET",
"tags" : [ "functionApi" ],
"register_time" : "2020-08-02T15:36:19Z",
"update_time" : "2020-08-02T15:47:53.499266Z"
} ]
} 状态码: 400
Bad Request
{
"error_code" : "APIG.2012",
"error_msg" : "Invalid parameter value,parameterName:name. Please refer to the support documentation"
} 状态码: 401
Unauthorized
{
"error_code" : "APIG.1002",
"error_msg" : "Incorrect token or token resolution failed"
} 状态码: 403
Forbidden
{
"error_code" : "APIG.1005",
"error_msg" : "No permissions to request this method"
} 状态码: 500
Internal Server Error
{
"error_code" : "APIG.9999",
"error_msg" : "System error"
} 状态码
| 状态码 | 描述 |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal Server Error |
错误码
请参见错误码。