
# 查询VPC路由列表 - ListVpcRoutes
#### 功能介绍
查询提交请求的租户的所有路由列表，并根据过滤条件进行过滤。分页查询响应格式请参考[分页查询](https://support.huaweicloud.com/api-vpc/vpc_version_0003.html)。
#### 调试
您可以在[API Explorer](https://apiexplorer.developer.huaweicloud.com/apiexplorer/doc?product=VPC&version=v2&api=ListVpcRoutes)中调试该接口。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-vpc/vpc_permission_0000.html)。
- 如果使用身份策略授权，当前API调用无需身份策略权限。
 
#### URI
GET /v2.0/vpc/routes
样例：
```
样例：
GET https://{Endpoint}/v2.0/vpc/routes?id={id}&vpc_id={vpc_id}&tenant_id={tenant_id}&destination={destination}&type={type}&limit={limit}&marker={marker}
```
参数说明请参见[表1]。
 表1参数说明 
| 名称          | 是否必选 | 参数类型    | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
|:---|:---|:---|:---|
| id          | 否    | String  | 按照routes_id过滤查询                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| tenant_id   | 否    | String  | 按照tenant_id过滤查询                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| vpc_id      | 否    | String  | 按照vpc_id过滤查询                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| destination | 否    | String  | 按照路由目的地址CIDR过滤查询                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| type        | 否    | String  | 按照type进行过滤查询，目前只支持peering                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| marker      | 否    | String  | 分页查询的起始资源ID，表示从指定资源的下一条记录开始查询。 marker需要和limit配合使用： - 若不传入marker和limit参数，查询结果返回第一页全部资源记录。  - 若不传入marker参数，limit为10，查询结果返回第1\~10条资源记录。  - 若marker为第10条记录的资源ID，limit为10，查询结果返回第11\~20条资源记录。  - 若marker为第10条记录的资源ID，不传入limit参数，查询结果返回第11\~2000条（limit默认值2000）资源记录。   |
| limit       | 否    | Integer | 分页查询每页返回的记录个数，取值范围为0\~2000，默认值2000。 limit需要和marker配合使用，详细规则请见marker的参数说明。 默认值为2000。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
   
#### 请求参数
无
#### 请求示例
```
GET https://{Endpoint}/v2.0/vpc/routes?vpc_id=ab78be2d-782f-42a5-aa72-35879f6890ff
```
#### 响应参数
表2响应参数 
| 参数名称         | 类型                                                                | 说明                                                                                                                                                                            |
|:---|:---|:---|
| routes       | Array of [route] objects       | route对象列表，参见[表3]。                                                                                                                          |
| routes_links | Array of [routes_link] objects | routes_link对象列表，参见[表4]。 只有在使用limit过滤，并且资源个数超过limit或者资源个数超过2000时（limit默认值），该参数的rel和href取值才会显示为next和其对应的link。 |
   
 表3route对象 
| 参数名称        | 类型     | 说明                                       |
|:---|:---|:---|
| id          | String | 路由id                                     |
| destination | String | 路由目的地址CIDR，如192.168.200.0/24。            |
| nexthop     | String | 路由下一跳，如果路由是"peering"类型，填写vpc peering id。 |
| type        | String | 路由类型。目前只支持"peering"。                     |
| vpc_id      | String | 路由的vpc，需要填写存在的vpc_id。                    |
| tenant_id   | String | 项目ID                                     |
   
 表4routes_link对象 
| 名称   | 参数类型   | 说明              |
|:---|:---|:---|
| href | String | API链接           |
| rel  | String | API链接与该API版本的关系 |
   
#### 响应示例
```
{ 
  "routes": [ 
    { 
      "type": "peering",  
      "nexthop": "60c809cb-6731-45d0-ace8-3bf5626421a9",  
      "destination": "192.168.200.0/24",  
      "vpc_id": "ab78be2d-782f-42a5-aa72-35879f6890ff",  
      "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
      "id": "3d42a0d4-a980-4613-ae76-a2cddecff054" 
    }
  ] 
}
```
#### 状态码
请参见[状态码](https://support.huaweicloud.com/api-vpc/vpc_api_0002.html)。
#### 错误码
请参考[错误码](https://support.huaweicloud.com/api-vpc/vpc_api_0003.html)。
