You need to enable JavaScript to run this app.
文档中心
API 网关

API 网关

复制全文
下载 pdf
路由管理
ListRoutes - 查询路由列表
复制全文
下载 pdf
ListRoutes - 查询路由列表
查询路由列表。​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。​
Action string 必选 示例值:ListRoutes​
要执行的操作,取值:ListRoutes。​
​
Version string 必选 示例值:2022-11-12​
API的版本,取值:2022-11-12。​
​
PageNumber long 可选 示例值:1​
分页查询的页号。取值最小限制为 1,默认值为 1。​
​
PageSize long 可选 示例值:10​
每页个数。取值范围为 0~100,默认值为 10。​
​
GatewayId string 可选 示例值:gd8****​
网关实例 ID。您可以通过 ListGateways 查询网关实例 ID。​
​
ServiceId string 可选 示例值:sd84****​
服务 ID。您可以通过 ListGatewayServices 查询服务 ID。​
​
UpstreamId string 可选 示例值:ud93****​
后端服务 Upstream ID。您可以通过 ListUpstreams 查询 Upstream ID。​
​
UpstreamVersion string 可选 示例值:test​
后端服务 Upstream 版本。​
​
Filter object 可选 示例值:-​
过滤条件。​
Name string 可选 示例值:example​
路由名称。​
​
UpstreamIds string[] 可选 示例值:["ud93****"]​
后端服务 Upstream ID。您可以通过 ListUpstreams 查询 Upstream ID。​
​
Path string 可选 示例值:/​
允许访问的请求路径。​
  • 必须以(/)开头,(/)不能超过 30 个。​
  • 支持 ASCII 可打印字符,长度限制为 1~256 个字符。​
  • 不能包含空格。请求路径。​
​
​
​
​
返回参数​
下方仅列出本接口特有的返回参数。更多信息请参见返回结构。​
Total long 示例值:10​
过滤后的路由总个数。​
​
Items object[] 示例值:-​
路由列表。​
Id string 示例值:rd93****​
路由 ID。​
​
Name string 示例值:example​
路由名称。​
​
ServiceId string 示例值:sd84****​
路由所属服务的 ID。​
​
ServiceName string 示例值:example​
路由所属服务的名称。​
​
CreateTime string 示例值:2025-01-01T00:00:00+08:00​
路由创建时间。​
标准 RFC3339 格式的 UTC+8 时间。​
​
UpdateTime string 示例值:2025-01-01T00:00:00+08:00​
路由更新时间。​
标准 RFC3339 格式的 UTC+8 时间。​
​
MatchRule object 示例值:-​
匹配规则。​
Path object 示例值:-​
允许访问的请求路径。​
  • 必须以(/)开头,(/)不能超过 30 个。​
  • 支持 ASCII 可打印字符,长度限制为 1~256 个字符。​
  • 不能包含空格。​
MatchType string 示例值:Exact​
请求匹配类型,取值:​
  • Exact:精准匹配。​
  • Prefix:前缀匹配。​
  • Regex:正则匹配。​
​
MatchContent string 示例值:example-value​
请求匹配值。​
  • 支持 ASCII 可打印字符,长度限制为 1~256 个字符。​
  • 不能包含空格。​
​
​
Method string[] 示例值:["GET","POST","PUT","DELETE","HEAD","OPTIONS","CONNECT","PATCH"]​
请求方法,取值:​
  • GET​
  • POST​
  • PUT​
  • DELETE​
  • HEAD​
  • OPTIONS​
  • CONNECT​
  • PATCH​
​
QueryString object[] 示例值:-​
请求参数。​
  • 支持 ASCII 可打印字符,长度限制为 1~256 个字符。​
  • 不能包含空格。​
Key string 示例值:example-key​
请求匹配键。​
​
Value object 示例值:-​
请求匹配值。​
MatchType string 示例值:Exact​
请求匹配类型,取值:​
  • Exact:精准匹配。​
  • Prefix:前缀匹配。​
  • Regex:正则匹配。​
​
MatchContent string 示例值:example-value​
请求匹配值。​
  • 支持 ASCII 可打印字符,长度限制为 1~256 个字符。​
  • 不能包含空格。​
​
​
​
Header object[] 示例值:-​
请求头。​
  • 长度限制为 0~5 个。​
  • 支持大小写字母、数字、中划线(-)和下划线(_),长度限制为 1~256 个字符。​
  • 不能包含空格。​
Key string 示例值:example-key​
请求匹配键。​
​
Value object 示例值:-​
请求匹配值。​
MatchType string 示例值:Exact​
请求匹配类型,取值:​
  • Exact:精准匹配。​
  • Prefix:前缀匹配。​
  • Regex:正则匹配。​
​
MatchContent string 示例值:example-value​
请求匹配值。​
  • 支持 ASCII 可打印字符,长度限制为 1~256 个字符。​
  • 不能包含空格。​
​
​
​
​
UpstreamList object[] 示例值:-​
Upstream 流量分发。​
UpstreamId string 示例值:ud93****​
对接的 Upstream ID。您可以通过 ListUpstreams 查询 Upstream ID。​
​
Weight integer 示例值:100​
当前 Upstream 的流量权重。整数形式,取值范围为 1~1000。​
说明​
系统会根据 Upstream 配置的权重总值和各 Upstream 的权重占比,按比例显示流量划分,百分比数字精确到两位小数。​
​
Version string 示例值:test​
灰度版本。​
  • 请输入 2~63 个字符。​
  • 字符中只能包含大小写字母、数字、和中划线(-)。​
  • 不能以中划线(-)开头。​
​
AIProviderSettings object 示例值:-​
AI 模型配置。​
说明​
当 Upstream 类型为 AI 模型代理时,需要配置本参数。​
Model string 示例值:doubao-seed-2-0-pro-260215​
目标模型。​
​
TargetPath string 示例值:/chat/completions​
精准重写路径。请求路径会由 Base URL 和精准重写路径拼接而成。例如当 Base URL 为/api/v3,精准重写路径为/chat/completions时,请求路径为/api/v3/chat/completions。​
说明​
当精准重写路径和前缀重写路径同时设置时,精准重写路径生效。​
​
PrefixPath string 示例值:/ep​
前缀重写路径。请求路径的前缀重写路径部分将改写为 Base URL。例如当 Base URL 为/api/v3,前缀重写路径为/ep时,请求路径/ep/chat/completions将被改写为/api/v3/chat/completions。​
说明​
当精准重写路径和前缀重写路径同时设置时,精准重写路径生效。​
​
​
​
AdvancedSetting object 示例值:-​
高级配置。​
TimeoutSetting object 示例值:-​
超时配置。​
Enable boolean 示例值:true​
是否开启超时配置。取值:​
  • true:开启。​
  • false:不开启。​
​
Timeout long 示例值:10​
超时时间,单位为秒。​
​
​
CorsPolicySetting object 示例值:-​
跨域配置。​
Enable boolean 示例值:true​
是否开启跨域配置。取值:​
  • true:开启。​
  • false:不开启。​
​
AllowCredentials boolean 示例值:false​
是否携带凭证。取值:​
  • true:携带。​
  • false:不携带。​
​
AllowMethods string[] 示例值:["GET","POST","PUT","DELETE","HEAD","OPTIONS","CONNECT","PATCH"]​
允许的 HTTP 方法,取值:​
  • GET​
  • POST​
  • PUT​
  • DELETE​
  • HEAD​
  • OPTIONS​
  • CONNECT​
  • PATCH​
​
AllowOrigins object[] 示例值:-​
允许的访问来源列表。​
Value string 示例值:true​
跨域列表。​
​
MatchType string 示例值:exact​
匹配类型,取值:​
  • exact:精准匹配。​
  • regex:正则匹配。​
​
​
AllowHeaders string[] 示例值:["example-header"]​
允许的非简单请求头。​
​
ExposeHeaders string[] 示例值:["example-header"]​
允许客户端获取的非简单响应头。​
​
MaxAge long 示例值:86400​
缓存时间。预检请求结果的有效缓存时间,单位为秒。​
​
​
URLRewriteSetting object 示例值:-​
URL 重写配置。​
说明​
当 Upstream 类型为 AI 模型代理时,URL 重写不生效。​
Enable boolean 示例值:true​
是否开启 URL 重写。取值:​
  • true:开启。​
  • false:不开启。​
​
URLRewrite string 示例值:/v2/​
重写路径。​
  • 必须以(/)开头,以(/)结尾,(/)不能超过 30 个。​
  • 支持 ASCII 可打印字符,长度限制为 1~256 个字符。​
​
​
HeaderOperations object[] 示例值:-​
修改请求头。长度限制为 0~5 个。​
Operation string 示例值:set​
请求头修改模式,取值:​
  • set:覆写。​
  • add:追加。​
  • remove:移除。​
​
Key string 示例值:example-key​
请求头的键。支持大小写字母、数字、中划线(-)和下划线(_),长度限制为 1~256 个字符。​
​
Value string 示例值:example-value​
请求头的值。支持大小写字母、数字、中划线(-)和下划线(_),长度限制为 1~256 个字符。​
​
​
MirrorPolicies object[] 示例值:-​
流量镜像。长度限制为 0~1 个。​
Upstream object 示例值:-​
后端 Upstream 配置。​
Type string 示例值:-​
镜像后端 Upstream 类型。​
说明​
当 Upstream 类型为函数服务或 AI 模型代理时,流量镜像不生效。​
​
UpstreamId string 示例值:ud93****​
后端 Upstream 的 ID。您可以通过 ListUpstreams 查询 Upstream ID。​
​
Version string 示例值:-​
灰度版本。​
​
​
Percent object 示例值:-​
镜像比例配置。​
Value double 示例值:50​
复制到镜像后端服务的流量比例值。取值范围为 0~100。​
​
​
​
RetryPolicySetting object 示例值:-​
重试配置。​
Enable boolean 示例值:true​
是否开启重试配置。取值:​
  • true:开启。​
  • false:不开启。​
​
Attempts long 示例值:2​
重试次数。​
​
RetryOn string[] 示例值:["5xx","reset","connect-failure"]​
重试条件,取值:​
  • 5xx:后端服务器返回 5xx 状态码,或发生连接断开、重置、读取超时事件。​
  • reset:发生连接断开、重置、读取超时事件。​
  • connect-failure:与后端服务器连接失败,请求出错。​
  • refused-stream:后端服务使用REFUSED\_STREAM错误码来重置流。​
  • cancelled:后端服务响应头中的 gRPC 状态码为cancelled。​
  • deadline-exceeded:后端服务响应头中的 gRPC 状态码为deadline-exceeded。​
  • internal:后端服务响应头中的 gRPC 状态码为internal。​
  • resource-exhausted:后端服务响应头中的 gRPC 状态码为resource-exhausted。​
  • unavailable:后端服务响应头中的 gRPC 状态码为unavailable。​
​
HttpCodes string[] 示例值:["500"]​
需要进行重试的 HTTP 状态码。​
​
​
​
Domains object[] 示例值:-​
默认域名。​
Domain string 示例值:http://example.apigateway-cn-beijing.volceapi.com​
默认域名地址。​
​
Type string 示例值:public​
默认域名类型,取值:​
  • public:公网。​
  • private:私网。​
​
​
Status string 示例值:-​
路由状态。​
​
Reason string 示例值:-​
不可用原因。​
​
Enable boolean 示例值:true​
是否开启路由上下线功能。取值:​
  • true:开启。​
  • false:不开启。​
说明​
该功能目前处于 邀测 阶段,如需使用,请联系客户经理。​
​
Priority long 示例值:100​
优先级。整数形式,取值范围为 0~100。数字越小,优先级越高。​
​
CustomDomains object[] 示例值:-​
自定义域名。​
Id string 示例值:d****​
自定义域名 ID。​
​
Domain string 示例值:example.com​
自定义域名。​
​
​
FallbackSetting object 示例值:-​
Fallback 配置。​
Enable boolean 示例值:false​
是否开启 Fallback。取值​
  • true:开启。​
  • false:不开启。​
​
FallbackUpstreams object[] 示例值:-​
Fallback Upstream 列表。长度限制为 1 个。​
UpstreamId string 示例值:ud93****​
对接的 Upstream ID。您可以通过 ListUpstreams 查询 Upstream ID。​
​
Weight integer 示例值:100​
当前 Upstream 的流量权重。整数形式,取值范围为 1~1000。​
说明​
系统会根据 Upstream 配置的权重总值和各 Upstream 的权重占比,按比例显示流量划分,百分比数字精确到两位小数。​
​
Version string 示例值:test​
灰度版本。​
  • 请输入 2~63 个字符。​
  • 字符中只能包含大小写字母、数字、和中划线(-)。​
  • 不能以中划线(-)开头。​
​
AIProviderSettings object 示例值:-​
AI 模型配置。​
说明​
当 Upstream 类型为 AI 模型代理时,需要配置本参数。​
Model string 示例值:doubao-seed-2-0-pro-260215​
目标模型。​
​
TargetPath string 示例值:/chat/completions​
精准重写路径。请求路径会由 Base URL 和精准重写路径拼接而成。例如当 Base URL 为/api/v3,精准重写路径为/chat/completions时,请求路径为/api/v3/chat/completions。​
说明​
当精准重写路径和前缀重写路径同时设置时,精准重写路径生效。​
​
PrefixPath string 示例值:/ep​
前缀重写路径。请求路径的前缀重写路径部分将改写为 Base URL。例如当 Base URL 为/api/v3,前缀重写路径为/ep时,请求路径/ep/chat/completions将被改写为/api/v3/chat/completions。​
说明​
当精准重写路径和前缀重写路径同时设置时,精准重写路径生效。​
​
​
​
Conditions string[] 示例值:["4xx"]​
Fallback 条件,取值:​
  • 4xx:后端服务器返回 4xx 状态码。​
  • 5xx:后端服务器返回 5xx 状态码,或发生连接断开、重置、读取超时事件。​
​
​
​
​
​
请求示例​
​
POST https://apig.cn-beijing.volcengineapi.com?Action=ListRoutes&Version=2022-11-12​
Content-Type: application/json​
{​
"PageNumber": 1,​
"PageSize": 10,​
"GatewayId": "gd8****",​
"ServiceId": "sd84****",​
"UpstreamId": "ud93****",​
"UpstreamVersion": "",​
"Filter": {​
"Name": "example",​
"Path": "/",​
"UpstreamIds": [​
"ud93****"​
]​
}​
}​
​
返回示例​
​
Content-Type: application/json​
{​
"ResponseMetadata": {​
"RequestId": "20230604110420****100232280022D31",​
"Action": "ListRoutes",​
"Version": "2022-11-12",​
"Service": "apig",​
"Region": "cn-beijing"​
},​
"Result": {​
"Total": 10,​
"Items": [​
{​
"Id": "rd93****",​
"Name": "example",​
"Enable": true,​
"Domains": [​
{​
"Type": "public",​
"Domain": "http://example.apigateway-cn-beijing.volceapi.com"​
}​
],​
"Priority": 100,​
"MatchRule": {​
"Path": {​
"MatchType": "Exact",​
"MatchContent": "example-value"​
},​
"Header": [​
{​
"Key": "example-key",​
"Value": {​
"MatchType": "Exact",​
"MatchContent": "example-value"​
}​
}​
],​
"Method": [​
"GET",​
"POST",​
"PUT",​
"DELETE",​
"HEAD",​
"OPTIONS",​
"CONNECT",​
"PATCH"​
],​
"QueryString": []​
},​
"ServiceId": "sd84****",​
"CreateTime": "2025-01-01T00:00:00+08:00",​
"UpdateTime": "2025-01-01T00:00:00+08:00",​
"ServiceName": "example",​
"UpstreamList": [​
{​
"Weight": 100,​
"Version": "",​
"UpstreamId": "ud93****",​
"AIProviderSettings": {​
"Model": "doubao-seed-2-0-pro-260215",​
"PrefixPath": "/ep",​
"TargetPath": "/chat/completions"​
}​
}​
],​
"CustomDomains": [​
{​
"Id": "d****",​
"Domain": "example.com"​
}​
],​
"AdvancedSetting": {​
"MirrorPolicies": [​
{​
"Percent": {​
"Value": 50​
},​
"Upstream": {​
"Type": "",​
"Version": "",​
"UpstreamId": "ud93****"​
}​
}​
],​
"TimeoutSetting": {​
"Enable": true,​
"Timeout": 10​
},​
"HeaderOperations": [​
{​
"Key": "example-key",​
"Value": "example-value",​
"Operation": "set"​
}​
],​
"CorsPolicySetting": {​
"Enable": true,​
"MaxAge": 86400,​
"AllowHeaders": [​
"example-header"​
],​
"AllowMethods": [​
"GET",​
"POST",​
"PUT",​
"DELETE",​
"HEAD",​
"OPTIONS",​
"CONNECT",​
"PATCH"​
],​
"AllowOrigins": [​
{​
"Value": "true",​
"MatchType": "exact"​
}​
],​
"ExposeHeaders": [​
"example-header"​
],​
"AllowCredentials": false​
},​
"URLRewriteSetting": {​
"Enable": true,​
"URLRewrite": "/v2/"​
},​
"RetryPolicySetting": {​
"Enable": true,​
"RetryOn": [​
"5xx",​
"reset",​
"connect-failure"​
],​
"Attempts": 2,​
"HttpCodes": [​
"500"​
]​
}​
},​
"FallbackSetting": {​
"Enable": true,​
"Conditions": [​
"4xx"​
],​
"FallbackUpstreams": []​
}​
}​
]​
}​
}​
​
错误码​
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。​
​
状态码​
错误码​
错误信息​
说明​
500​
InternalError​
The request has failed due to an unknown error.​
未知错误。请稍后重试。如果多次尝试失败,请提交工单。​
500​
InternalServiceError​
record not found​
内部错误,请稍后重试​
​
​
最近更新时间:2026.10.28 14:59:49
这个页面对您有帮助吗?
有用
有用
无用
无用