查询API运行时定义
功能介绍
查看指定的API在指定的环境上的运行时定义,默认查询RELEASE环境上的运行时定义。
API的定义分为临时定义和运行时定义,分别代表如下含义:
访问某个环境上的API,其实访问的就是其运行时的定义
调用方法
请参见如何调用API。
URI
GET /v2/{project_id}/apigw/instances/{instance_id}/apis/runtime/{api_id}
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目ID,获取方式请参见获取项目ID。 |
instance_id |
是 |
String |
实例ID,在API网关控制台的“实例信息”中获取。 |
api_id |
是 |
String |
API的编号 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
env_id |
否 |
String |
API的发布环境编号 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
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的认证方式 |
auth_opt |
AuthOpt object |
认证方式参数 |
cors |
Boolean |
是否支持跨域 缺省值:false |
trace_enabled |
Boolean |
是否开启链路追踪, 默认关闭。 缺省值:false |
sampling_strategy |
String |
采样策略,当选择开启链路追踪时,此字段必填 |
sampling_param |
String |
采样参数 缺省值:100 最小长度:1 最大长度:64 |
match_mode |
String |
API的匹配方式 默认:NORMAL |
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 |
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 |
is_send_fg_body_base64 |
Boolean |
是否对与FunctionGraph交互场景的body进行Base64编码。仅当content_type为application/json时,可以不对body进行Base64编码。 应用场景: 缺省值:true |
id |
String |
API编号 |
group_name |
String |
API所属分组的名称 |
run_env_name |
String |
发布的环境名 |
run_env_id |
String |
发布的环境id |
publish_id |
String |
发布记录的编号 |
sl_domain |
String |
分组的二级域名 |
sl_domains |
Array of strings |
系统默认分配的子域名列表 |
req_params |
Array of ReqParam objects |
API的请求参数列表 |
参数 |
参数类型 |
描述 |
---|---|---|
app_code_auth_type |
String |
AppCode简易认证类型,仅在auth_type为APP时生效,默认为DISABLE: 缺省值:DISABLE |
参数 |
参数类型 |
描述 |
---|---|---|
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 |
是否透传 |
orchestrations |
Array of strings |
请求参数匹配编排规则的生效优先级与列表顺序保持一致,列表中靠前的配置匹配优先级较高; 如果编排规则列表中包含none_value类型的规则,则none_value类型的规则优先级最高,至多绑定一个none_value类型的规则; 如果编排规则列表中包含default类型的规则,则default类型的规则优先级最低,至多绑定一个default类型的规则; 当编排规则为预处理策略时,该规则不能作为除default以外的最后一个编排规则; 每个API仅允许选择一个参数绑定编排规则,且编排规则不能重复,支持绑定的编排规则数量有配额限制,具体请参见产品介绍的“约束与限制”章节。 |
id |
String |
参数编号 |
状态码:401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
状态码:403
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
状态码:404
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
状态码:500
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
请求示例
无
响应示例
状态码:200
OK
{
"name" : "Api_http",
"type" : 1,
"version" : "V0.0.1",
"req_protocol" : "HTTPS",
"req_method" : "GET",
"req_uri" : "/test/http",
"auth_type" : "AUTHORIZER",
"authorizer_id" : "8d0443832a194eaa84244e0c1c1912ac",
"auth_opt" : {
"app_code_auth_type" : "DISABLE"
},
"cors" : false,
"match_mode" : "NORMAL",
"backend_type" : "HTTP",
"remark" : "Web backend API",
"group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600",
"result_normal_sample" : "Example success response",
"result_failure_sample" : "Example failure response",
"id" : "5f918d104dc84480a75166ba99efff21",
"group_name" : "api_group_001",
"run_env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID",
"run_env_name" : "RELEASE",
"publish_id" : "9191cdb430724d4b8586ed7f1b962ca2",
"sl_domain" : "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.com",
"sl_domains" : [ "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.com", "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.cn" ]
}
状态码: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"
}
状态码:404
Not Found
{
"error_code" : "APIG.3002",
"error_msg" : "API 5f918d104dc84480a75166ba99efff21 does not exist"
}
状态码:500
Internal Server Error
{
"error_code" : "APIG.9999",
"error_msg" : "System error"
}
状态码
状态码 |
描述 |
---|---|
200 |
OK |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server Error |
错误码
请参见错误码。