# 管理路由表 ## 先决条件 身份验证 - 请提交您的用户凭据、客户端 ID 和客户端密钥以进行 OAuth2 身份验证。有关如何调用 OAuth API 来验证和确认您的凭据的说明,请参阅[API 身份验证](https://docs.equinix.com/zh-Hans/equinix-api/api-authentication.md)。 ## 更新路由表 要触发 Fabric Cloud Router 路由表的更新,请向 [`/fabric/v4/routers/{uuid}/actions`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#operation/createCloudRouterAction) 端点发送 `POST` 请求。 | | **`POST /fabric/v4/routers/{uuid}/actions`** | | ---------------- | -------------------------------------------- | | Method | `POST` | | URL or Endpoint | `/fabric/v4/routers/{uuid}/actions` | | Headers | `Authorization`, `Content-Type` | | Path Parameters | `uuid` | | Query Parameters | Not applicable | | Body Parameters | `type` | 示例 curl 请求: ``` curl -X POST 'https://api.equinix.com/fabric/v4/routers/{router_uuid}/actions' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{     "type": "ROUTE_TABLE_ENTRY_UPDATE" }' ``` 机身参数: * `type`(必填)*string* - 路由表管理操作。要更新路由表,请使用 `ROUTE_TABLE_ENTRY_UPDATE`。要查看通过 BGP 学习到的所有前缀,请使用 `RECEIVED_ROUTE_ENTRY_UPDATE`。要查看 FCR 通过 BGP 发送的前缀,请使用 `ADVERTISED_ROUTE_ENTRY_UPDATE`。 * `connection`(可选)*object* - 包含 `uuid` 字段的对象,用于指定连接。仅 `RECEIVED_ROUTE_ENTRY_UPDATE` 和 `ADVERTISED_ROUTE_ENTRY_UPDATE` 类型需要。 有关完整的参数信息和示例,请参阅[API 参考](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#operation/createCloudRouterAction)。 示例响应: ``` {     "type": "ROUTE_TABLE_ENTRY_UPDATE",     "uuid": "37c10edc-ba2e-4240-a850-8a48f9c47d00",     "state": "PENDING",     "changeLog": {         "createdDateTime": "2021-07-15T19:30:29.526Z",         "updatedDateTime": "2021-08-15T19:30:29.526Z"     } } ``` ## 获取路由表管理请求 要获取路由表管理请求列表,请向 [`/fabric/v4/routers/{uuid}/actions`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Cloud-Routers/operation/getCloudRouterActions) 端点发送 `GET` 请求。使用 `state` 查询参数按请求状态筛选响应。 | | `GET /fabric/v4/routers/{uuid}/actions` | | ---------------- | --------------------------------------- | | Method | `GET` | | URL or Endpoint | `/fabric/v4/routers/{uuid}/actions` | | Headers | `Authorization` | | Path Parameters | `uuid` | | Query Parameters | `state` | | Body Parameters | Not applicable | 此 API 检索路由表管理操作请求。 **示例 curl 请求** ``` curl -X GET 'https://api.equinix.com/fabric/v4/routers/{router_uuid}/actions?state=' -H 'authorization: Bearer ' ``` 查询参数: * `state`(可选)*string* - 操作执行状态。适用值:`PENDING`、`SUCCEEDED` 或 `FAILED`。 示例响应: ``` {     "type": "ROUTE_TABLE_ENTRY_UPDATE",     "uuid": "37c10edc-ba2e-4240-a850-8a48f9c47d00",     "state": "PENDING",     "changeLog": {         "createdDateTime": "2021-07-15T19:30:29.526Z",         "updatedDateTime": "2021-08-15T19:30:29.526Z"     } } ``` ## 搜索路由表管理请求 要搜索路由表管理请求,请向 [`/fabric/v4/routers/{routerId}/actions/search`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Cloud-Routers/operation/searchRouterActions) 端点发送 `POST` 请求,并在请求正文中指定搜索条件。 | | `POST /fabric/v4/routers/{routerId}/actions/search` | | ---------------- | --------------------------------------------------- | | Method | `POST` | | URL or Endpoint | `/fabric/v4/routers/{routerId}/actions/search` | | Headers | `Authorization`, `Content-Type` | | Path Parameters | `routerId` | | Query Parameters | Not applicable | | Body Parameters | `filter`, `pagination`, `sort` | 示例 curl 请求: ``` curl -X POST 'http: //api.equinix.com/fabric/v4/routers/{router_uuid}/actions/search' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{   "filter": {     "and": [       {         "property": "/type",         "operator": "IN",         "values": [           "ROUTE_TABLE_ENTRY_UPDATE",           "RECEIVED_ROUTE_ENTRY_UPDATE"         ]       },       {         "property": "/state",         "operator": "=",         "values": [           "SUCCEEDED"         ]       },       {         "property": "/connection/uuid",         "operator": "IN",         "values": [           "3066ab1d-af87-49d7-8a14-c9bdb57ac809"         ]       }     ]   },   "pagination": {     "offset": 0,     "limit": 1   },   "sort": [     {       "property": "/changeLog/createdDateTime",       "direction": "DESC"     }   ] }' ``` 值得注意的身体参数: * `filter`(必填)*object* - 定义搜索条件的对象。 * `and`(必填)*array\[object]* - 一个数组对象,用作应用于数组中搜索对象的逻辑运算符。您可以搜索: * `property`(必填)*string* - 搜索字段参数。请注意,属性值决定了适用的运算符和值列表。适用值:`"/name"`、`"/uuid"`、`"/state"`、`"/location/metroCode"`、`"/location/metroName"`、`"/package/code"` 和全类别搜索 `"\*"`。 * `operator`(必填)*string* - 搜索字段参数运算符。适用值:`"="`、`"!="`、`">"`、`">="`、`"<"`、`"<="`、`BETWEEN`、`LIKE`、`IN`、`"NOT BETWEEN"`、`"NOT LIKE"`、`"NOT IN"`。 * `value`(必填)*array\[string]* - 搜索字段参数值。 * `pagination` *object* - 可选对象,包含搜索结果分页设置,带有 `offset` *integer* 和 `limit` *integer* 字段。 * `sort` *object* - 可选对象,用于定义搜索结果排序设置,包含 `direction` *string* 和 `property` *string* 字段。 有关可搜索属性、分页限制和可排序属性的完整列表,请参阅[API 参考](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#operation/searchCloudRouters)。 示例响应: ``` {   "pagination": {     "offset": 0,     "limit": 1,     "total": 2,     "prev": null,     "next": null   },   "data": [     {       "href": "https://api.equinix.com//fabric/v4/routers/a1c6b7fd-aead-410a-96b4-b1dfa1071700/actions/1e9414f1-763e-4c0a-86c6-0bc8336048d9",       "uuid": "1e9414f1-763e-4c0a-86c6-0bc8336048d9",       "type": "RECEIVED_ROUTE_ENTRY_UPDATE",       "state": "SUCCEEDED",       "connection": {         "uuid": "3066ab1d-af87-49d7-8a14-c9bdb57ac809"       },       "operation": {         "bgpIpv4RoutesCount": 6,         "bgpIpv6RoutesCount": 6       },       "changeLog": {         "createdDateTime": "2024-01-01T01:00:00.000Z",         "updatedDateTime": "2024-01-01T01:01:00.000Z"       }     }   ] } ```