查询API运行时定义
功能介绍
查看指定的API在指定的环境上的运行时定义,默认查询RELEASE环境上的运行时定义。
API的定义分为临时定义和运行时定义,分别代表如下含义:
- 临时定义:API在编辑中的定义,表示用户最后一次编辑后的API的状态
- 运行时定义:API在发布到某个环境时,对发布时的API的临时定义进行快照,固化出来的API的状态。
访问某个环境上的API,其实访问的就是其运行时的定义
URI
HTTP/HTTPS请求方法以及URI如下表所示。
|
请求方法 |
URI |
|---|---|
|
GET |
/v1/{project_id}/apigw/instances/{instance_id}/apis/runtime/{id}[?env_id] |
- 可以在URI后面用‘?’和‘&’添加不同的查询条件组合。
- 查询条件可为以下字段以及对应的值:env_id。
URI中的参数说明如下表所示。
|
名称 |
是否必选 |
类型 |
说明 |
|---|---|---|---|
|
project_id |
是 |
String |
项目ID。可从控制台“我的凭证”中获取region下项目ID,管理员权限可查询。 |
|
instance_id |
是 |
String |
实例ID,可从API网关控制台的专享版实例信息中获取。 |
|
id |
是 |
String |
API的编号 |
请求消息
|
名称 |
是否必选 |
类型 |
说明 |
|---|---|---|---|
|
env_id |
否 |
String |
API的发布环境编号 |
响应消息
|
参数 |
类型 |
说明 |
|---|---|---|
|
id |
String |
API编号 |
|
name |
String |
API名称 |
|
group_id |
String |
API所属分组的编号 |
|
group_name |
String |
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匹配方式 |
|
remark |
String |
API描述 |
|
bakend_type |
String |
后端类型 |
|
run_env_name |
String |
发布的环境名 |
|
run_env_id |
String |
发布的环境id |
|
publish_id |
String |
发布记录的编号 |
|
tag |
String |
服务名称标签,待废弃字段 |
|
tags |
[]String |
标签 |
|
cors |
Bool |
是否支持跨域访问 |
|
body_remark |
String |
API请求体描述,可以是请求体示例、媒体类型、参数等信息 |
|
result_normal_sample |
String |
正常响应示例,描述API的正常返回信息 |
|
result_failure_sample |
String |
失败返回示例,描述API的异常返回信息 |
|
sl_domain |
String |
分组的二级域名 |
|
req_params |
字典数据类型 |
API的请求参数列表 |
|
参数 |
类型 |
说明 |
|---|---|---|
|
id |
String |
参数编号 |
|
name |
String |
参数名称 |
|
type |
String |
参数类型 |
|
location |
String |
参数位置 |
|
default_value |
String |
参数默认值 |
|
sample_value |
String |
参数示例值 |
|
required |
Integer |
是否必须 |
|
valid_enable |
Integer |
是否开启校验 |
|
remark |
String |
描述 |
|
enumerations |
String |
参数枚举值 |
|
min_num |
Integer |
参数最小值(参数类型为NUMBER时有效) |
|
max_num |
Integer |
参数最大值(参数类型为NUMBER时有效) |
|
min_size |
Integer |
参数最小长度 |
|
max_size |
Integer |
参数最大长度 |
|
regular |
String |
正则校验规则 |
|
json_schema |
String |
JSON校验规则 |
|
参数 |
类型 |
说明 |
|---|---|---|
|
app_code_auth_type |
String |
AppCode简易认证类型 |
响应消息样例:
{
"name": "market_api01",
"type": 1,
"version": "V0.0.1",
"req_protocol": "HTTPS",
"req_method": "GET",
"req_uri": "/test01",
"auth_type": "APP",
"auth_opt": {
"app_code_auth_type": "HEADER"
},
"tags": ["APIG-SN-test", "test"],
"cors": true,
"match_mode": "NORMAL",
"backend_type": "MOCK",
"remark": "market_api01",
"group_id": "7f848adc971749cda9c6aff3877cfc3e",
"body_remark": "market_api01",
"result_normal_sample": "success",
"result_failure_sample": "",
"id": "0e51b689e0784bc884f43756bbf34fa5",
"group_name": "market_group01",
"run_env_id": "DEFAULT_ENVIRONMENT_RELEASE_ID",
"run_env_name": "RELEASE",
"publish_id": "f07eb9f5e5ba4bbfbe89326f5cae99c7",
"sl_domain": "61297835ff1e4905b6f635dbcdf1777e.apigw.example.com",
"req_params": [
{
"name": "project_id",
"type": "STRING",
"location": "PATH",
"default_value": "",
"sample_value": "",
"required": 1,
"valid_enable": 2,
"remark": "",
"enumerations": "",
"min_num": 0,
"max_num": 0,
"min_size": 0,
"max_size": 0,
"regular": "",
"json_schema": "",
"id": "2a61905ea2304186a9422faba2940735"
}
]
}
状态码
|
状态码 |
说明 |
|---|---|
|
200 |
OK |
|
400 |
Bad Request |
|
401 |
Unauthorized |
|
403 |
Forbidden |
|
404 |
Not Found |