# 获取端口信息 ## 先决条件[​](#先决条件 "直接链接至先决条件") 验证-提交您的用户凭据,客户端ID和客户端机密以进行OAuth2 验证。有关如何致电OAuth API以验证和验证您的凭据的说明,请参阅[API验证](https://docs.equinix.com/zh-Hans/equinix-api/api-authentication.md)。 ## 获取所有端口[​](#获取所有端口 "直接链接至获取所有端口") 您可以通过向端点发送请求[`/fabric/v4/ports`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/ports/getports.md)来检索用户凭据的所有可用端口`GET`。 | | | | ---------- | ------------------ | | 方法 | `GET` | | URL 或端点 | `/fabric/v4/ports` | | 标题 | `Authorization` | | 路径参数 | 不适用 | | 查询参数 | `name` | | 身体参数 | 不适用 | cURL 请求示例: ``` curl -X GET 'https://api.equinix.com/fabric/v4/ports' -H 'Authorization: Bearer ' ``` 示例回答: ``` { "pagination": { "offset": 0, "limit": 1000, "total": 2 }, "data": [ { "href": "https://api.equinix.com/fabric/v4/ports/c4d93b39-02db-2dbc-ace0-30fa5c00ad04", "type": "XF_PORT", "uuid": "c4d93b39-02db-2dbc-ace0-30fa5c00ad04", "name": "gen-l2-qa-01-auto-TY4-L-Qinq-STD-SEC-10G-JUN-598", "physicalPortsSpeed": 10000, "physicalPortsType": "10GBASE_LR", "connectivitySourceType": "COLO", "project": { "projectId": "333cd592-1709-4238-bb0d-2c2b41896aa1" }, "package": { "code": "STANDARD" }, "state": "REPROVISIONING", "cvpId": "1616554", "operation": { "connectionCount": 0, "evplVCCount": 0, "accessVCCount": 0 }, "account": { "accountNumber": 200559, "accountName": "gen-l2-qa-01-auto-200559", "orgId": 90946, "organizationName": "gen-l2-qa-01-auto-200551.", "ucmId": "500DFED2-EBDB-480d-896C-C7870E52D0D8", "globalCustId": "0017i000011X242AAC" }, "changeLog": { "createdBy": "vvyugovskiy-IMPORT_JOB", "createdDateTime": "2021-06-16T01:46:52Z", "updatedBy": "Order-to-activation", "updatedDateTime": "2025-04-07T23:03:08.900Z" }, "bandwidth": 10000, "availableBandwidth": 10000, "usedBandwidth": 0, "location": { "metroHref": "https://api.equinix.com/fabric/v4/metros/TY", "region": "APAC", "metroName": "Tokyo", "metroCode": "TY", "ibx": "TY4" }, "device": { "name": "sit-tb1-ty-a2.lab", "redundancy": { "priority": "SECONDARY" } }, "demarcationPointIbx": "TY4", "tetherIbx": "TY4", "redundancy": { "priority": "SECONDARY" }, "encapsulation": { "type": "QINQ", "tagProtocolId": 37120 }, "lagEnabled": false, "settings": { "buyout": false }, "physicalPorts": [ { "type": "XF_PHYSICAL_PORT", "id": 1362185, "state": "TO_BE_ADDED", "uuid": "01892489-ce9b-7f25-b1f5-d32a5ac6a423", "tether": { "crossConnectId": "ECX.05.00001836", "cabinetNumber": "Demarc", "systemName": "TY4:01:002181", "patchPanel": "PP:1240:1089399", "patchPanelPortA": "7", "patchPanelPortB": "8", "ibx": "TY4" }, "demarcationPoint": { "patchPanel": "PP:Demarc:00002181", "patchPanelName": "PP:Demarc:00002181", "patchPanelPortA": "5", "patchPanelPortB": "6", "ibx": "TY4" }, "operation": { "operationalStatus": "UP" } } ] }, { "href": "https://api.equinix.com/fabric/v4/ports/6f0f3015-2d51-4b6e-a98c-1defb4fe88f1", "type": "XF_PORT", "uuid": "6f0f3015-2d51-4b6e-a98c-1defb4fe88f1", "name": "200558-SY4-CX-PRI-02", "physicalPortsSpeed": 10000, "physicalPortsType": "10GBASE_LR", "project": { "projectId": "333cd592-1709-4238-bb0d-2c2b41896aa1" }, "package": { "code": "STANDARD" }, "state": "ACTIVE", "cvpId": "2000348", "operation": { "connectionCount": 1, "evplVCCount": 1, "accessVCCount": 0 }, "account": { "accountNumber": 200558, "accountName": "Gen-L2-Qa-01-Auto-200558", "orgId": 90946, "organizationName": "gen-l2-qa-01-auto-200551.", "ucmId": "2D26D682-B62E-495d-AFDF-698EC3B353F8", "globalCustId": "0017i000011X242AAC" }, "changeLog": { "createdDateTime": "2025-05-06T17:29:30.800Z", "updatedBy": "API", "updatedDateTime": "2025-05-06T17:29:40.300Z" }, "bandwidth": 10000, "availableBandwidth": 9500, "usedBandwidth": 500, "location": { "metroHref": "https://api.equinix.com/fabric/v4/metros/SY", "region": "APAC", "metroName": "Sydney", "metroCode": "SY", "ibx": "SY4" }, "device": { "name": "sit-tb1-sy-e1.lab", "redundancy": { "group": "1", "priority": "PRIMARY" } }, "demarcationPointIbx": "SY4", "tetherIbx": "SY4", "redundancy": { "priority": "PRIMARY" }, "encapsulation": { "type": "DOT1Q", "tagProtocolId": 33024 }, "lagEnabled": true, "settings": { "buyout": false }, "physicalPorts": [ { "type": "XF_PHYSICAL_PORT", "id": 1362737, "state": "ACTIVE", "uuid": "01892489-ce07-7962-b676-b1a4d8091515", "tether": { "crossConnectId": "22035616", "cabinetNumber": "Demarc", "systemName": "SY4:01:002204", "patchPanel": "PP:1240:1089399", "patchPanelPortA": "12", "patchPanelPortB": "14", "ibx": "SY4" }, "demarcationPoint": { "patchPanel": "PP:Demarc:00002204", "patchPanelName": "PP:Demarc:00002204", "patchPanelPortA": "17", "patchPanelPortB": "18", "ibx": "SY4" }, "operation": { "operationalStatus": "UP" } } ] } ] } ``` 响应字段的详细说明,请参阅《[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/ports/getports.md)》。 ## 获取端口的详细信息[​](#获取端口的详细信息 "直接链接至获取端口的详细信息") 要获取端口的详细信息,请向端点发送`GET`请求[`/fabric/v4/ports/{portUuid}`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/ports/getportbyuuid.md),并在请求路径中指定端口的ID。 | | | | ---------- | ----------------------------- | | 方法 | `GET` | | URL 或端点 | `/fabric/v4/ports/{portUuid}` | | 标题 | `Authorization` | | 路径参数 | `uuid` | | 查询参数 | 不适用 | | 身体参数 | 不适用 | cURL 请求示例: ``` curl -X GET 'https://api.equinix.com/fabric/v4/ports/{port_id}' -H 'Authorization: Bearer ' ``` 示例回答: ``` { "href": "https://api.equinix.com/fabric/v4/ports/44c5712b-d704-4ca5-9b42-ee6be32ee06a", "type": "XF_PORT", "uuid": "44c5712b-d704-4ca5-9b42-ee6be32ee06a", "name": "270843-DA1-CX-PRI-33", "physicalPortsSpeed": 1000, "physicalPortsType": "1000BASE_LX", "project": { "projectId": "66a2d2f7-b79b-49bc-8642-d2b3c1c138b4" }, "package": { "code": "UNLIMITED" }, "state": "ACTIVE", "cvpId": "2000833", "connectivitySourceType": "COLO", "operation": { "operationalStatus": "UP", "connectionCount": 10, "evplVCCount": 10, "accessVCCount": 0 }, "account": { "accountNumber": 270843, "accountName": "ctr-sit-account1", "orgId": 93055, "organizationName": "ctr-sit-account1-270843", "ucmId": "64726950-A62C-4749-98E2-5AA4CA44284F", "globalCustId": "0016u000003JZ3XAAW" }, "change": { "uuid": "ed41e367-e09d-4c2f-b6ab-30506de4437f", "type": "PORT_UPDATE", "status": "COMPLETED", "data": { "op": "REPLACE", "path": "/encapsulation", "value": { "type": "QINQ", "tagProtocolId": 34984 } }, "createdDateTime": "2025-05-29T20:38:45.630759Z", "updatedDateTime": "2025-05-29T20:38:49.330822Z" }, "changeLog": { "createdBy": "qa-automation", "createdDateTime": "2025-05-21T18:12:18.300Z", "updatedBy": "qa-automation", "updatedDateTime": "2025-05-29T20:38:48.900Z" }, "bandwidth": 1000, "availableBandwidth": 500, "usedBandwidth": 500, "location": { "metroHref": "https://api.equinix.com/fabric/v4/metros/DA", "region": "AMER", "metroName": "Dallas", "metroCode": "DA", "ibx": "DA1" }, "device": { "name": "qa3-da-a1.lab", "redundancy": { "priority": "PRIMARY" } }, "demarcationPointIbx": "DA1", "tetherIbx": "DA1", "redundancy": { "priority": "PRIMARY" }, "encapsulation": { "type": "QINQ", "tagProtocolId": 34984 }, "lagEnabled": false, "settings": { "buyout": true, "viewPortPermission": true, "placeVcOrderPermission": true }, "physicalPorts": [ { "type": "XF_PHYSICAL_PORT", "id": 1426359, "state": "ADDED", "bandwidth": 0, "uuid": "0189244a-f3ac-7258-a8b4-3167af899305", "tether": { "crossConnectId": "513213223", "ibx": "DA1" }, "demarcationPoint": { "ibx": "DA1" }, "operation": { "operationalStatus": "UP" } } ] } ``` 响应字段的详细说明,请参阅《[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/ports/getportbyuuid.md)》。 ## 获取已使用的 Vlan[​](#获取已使用的-vlan "直接链接至获取已使用的 Vlan") 要获取端口使用的VLAN列表,请向端点发送`GET`请求[`/fabric/v4/ports/{portUuid}/linkProtocols`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/ports/getvlans.md)。在请求路径中按ID指定端口。 | | | | ---------- | ------------------------------------------- | | 方法 | `GET` | | URL 或端点 | `/fabric/v4/ports/{portUuid}/linkProtocols` | | 标题 | `Authorization` | | 路径参数 | `uuid` | | 查询参数 | `offset`,`limit` | | 身体参数 | 不适用 | cURL 请求示例: ``` curl -X GET 'https://api.equinix.com/fabric/v4/ports/{port_id}/linkProtocols' -H 'Authorization: Bearer ' ``` 示例回答: ``` { "pagination": { "offset": 0, "limit": 20, "total": 5 }, "data": [ { "type": "QINQ", "uuid": "52d61263-fb0a-459d-a086-bc7fd6bd7384", "state": "RESERVED", "vlanSTag": 1000, "vlanCTag": 500, "asset": { "href": "https://api.equinix.com/fabric/v4/connections/cd67f685-41b0-1b07-6de0-320a5c00abee", "uuid": "cd67f685-41b0-1b07-6de0-320a5c00abee" }, "changeLog": { "createdDateTime": "2020-05-21T10:30:00Z" } }, { "type": "QINQ", "uuid": "8c589394-b0eb-4057-97dc-3bdb4f8ff6db", "state": "RESERVED", "vlanSTag": 1000, "vlanCTag": 500, "serviceToken": { "href": "https://api.equinix.com/fabric/v4/serviceTokens/fc4fb78a-6b89-462d-a233-e75ef61a603f", "uuid": "fc4fb78a-6b89-462d-a233-e75ef61a603f" }, "changeLog": { "createdDateTime": "2020-05-21T10:30:00Z" } }, { "type": "QINQ", "uuid": "7f1da56d-e1ff-4b25-b542-883c7004e971", "state": "RESERVED", "vlanSTag": 1000, "vlanCTag": 500, "serviceToken": { "href": "https://api.equinix.com/fabric/v4/serviceTokens/90f1af0e-134b-40d6-a007-e62cd6866373", "uuid": "90f1af0e-134b-40d6-a007-e62cd6866373", "bandwidth": 1000 }, "changeLog": { "createdDateTime": "2020-05-21T10:30:00Z" } }, { "type": "QINQ", "uuid": "7c968801-e03b-4530-8424-aa5ecc4339e2", "state": "RESERVED", "vlanSTag": 1000, "vlanCTag": 500, "asset": { "href": "https://api.equinix.com/fabric/v4/connections/2ac4e14f-6120-4705-886e-d37f1d0c6a65", "uuid": "2ac4e14f-6120-4705-886e-d37f1d0c6a65" }, "changeLog": { "createdDateTime": "2020-05-21T10:30:00Z" } }, { "type": "QINQ", "uuid": "db812bba-94b8-43e6-8d9c-850f04350c3d", "state": "RESERVED", "vlanSTag": 1001, "vlanCTag": 1001, "asset": { "href": "https://api.equinix.com/fabric/v4/connections/3268d105-e57b-4b2b-8a0a-2e3e42312d95", "uuid": "3268d105-e57b-4b2b-8a0a-2e3e42312d95" }, "changeLog": { "createdDateTime": "2020-05-21T10:30:00Z", "updatedDateTime": "2020-05-21T10:30:00Z" } } ] } ``` 响应字段的详细说明,请参阅《[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/ports/getvlans.md)》。 ## 搜索端口[​](#搜索端口 "直接链接至搜索端口") 要搜索端口上的信息,请向端点发送`POST`请求[`/fabric/v4/ports/search`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/ports/searchports.md)。使用请求正文中可用的参数指定搜索条件。 | | | | ---------- | ------------------------------- | | 方法 | `POST` | | URL 或端点 | `/fabric/v4/ports/search` | | 标题 | `Authorization`,`Content-Type` | | 路径参数 | 不适用 | | 查询参数 | 不适用 | | 身体参数 | `filter`,`pagination`,`sort` | cURL 请求示例: ``` curl -X POST 'https://api.equinix.com/fabric/v4/ports/search' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{ "filter": { "or": [ { "and": [ { "property": "/state", "operator": "=", "values": [ "ACTIVE", "REPROVISIONING" ] }, { "property": "/settings/productCode", "operator": "=", "values": [ "CX" ] }, { "property": "/project/projectId", "operator": "=", "values": [ "66a2d2f7-b79b-49bc-8642-d2b3c1c138b4" ] } ] } ] }, "pagination": { "limit": 1000, "offset": 0 }, "sort": [ { "property": "/device/name", "direction": "DESC" } ] }' ``` 值得注意的身体参数: | **参数** | **描述** | | ------------------------- | -------------------------------------------------------------------------------------- | | 过滤器`object`为必填项 | 包含用于搜索端口的过滤条件的对象。 | | 或`array[object]`必填 | 通过“或”运算符连接的标准数组。 | | 和`array[object]`必填 | 通过“and”运算符连接的条件数组。 | | 属性`string`为必填项 | 根据过滤条件搜索端口。**适用值:** */project/projectId* /state \*/settings/productCode | | `string`Operator为必填项 | 参数运算符。**适用值:** \*= | | 值`string`为必填项 | 参数值。\*\*示例:\*\*3a58dd05-f46d-4b1d-a154-2e85c396ea62 | | | | | **/project/projectId** | **示例:**"属性":"/project/projectId","运营商":"","值":\["xx-xx-xx"] | | `string`Operator为必填项 | 搜索字段运营商。**适用值:** \*= | | 值`array[string]`为必填项 | 连接名称。**示例:**\["xx-xx-xx"] | | | | | **/州** | **示例:**"属性":“/州”,“运营商”:"","值":\[“已激活] | | `string`Operator为必填项 | 搜索字段运营商。**适用值:** \*= | | 值`array[string]`为必填项 | 端口状态。**示例:**\["已激活"] | | | | | **/settings/productCode** | **示例:**"属性":"/settings/ProductCode",“运营商”:"","值":\[“CX”] | | `string`Operator为必填项 | 搜索字段运营商。**适用值:** \*= | | 值`array[string]`为必填项 | 按端口状态搜索。**示例:**\["CX"] | 示例回答: ``` { "pagination": { "offset": 0, "limit": 1000, "total": 2 }, "data": [ { "href": "https://api.equinix.com/fabric/v4/ports/c4d93b39-02db-2dbc-ace0-30fa5c00ad04", "type": "XF_PORT", "uuid": "c4d93b39-02db-2dbc-ace0-30fa5c00ad04", "name": "gen-l2-qa-01-auto-TY4-L-Qinq-STD-SEC-10G-JUN-598", "physicalPortsSpeed": 10000, "physicalPortsType": "10GBASE_LR", "connectivitySourceType": "COLO", "project": { "projectId": "333cd592-1709-4238-bb0d-2c2b41896aa1" }, "package": { "code": "STANDARD" }, "state": "REPROVISIONING", "cvpId": "1616554", "operation": { "connectionCount": 0, "evplVCCount": 0, "accessVCCount": 0 }, "account": { "accountNumber": 200559, "accountName": "gen-l2-qa-01-auto-200559", "orgId": 90946, "organizationName": "gen-l2-qa-01-auto-200551.", "ucmId": "500DFED2-EBDB-480d-896C-C7870E52D0D8", "globalCustId": "0017i000011X242AAC" }, "changeLog": { "createdBy": "vvyugovskiy-IMPORT_JOB", "createdDateTime": "2021-06-16T01:46:52Z", "updatedBy": "Order-to-activation", "updatedDateTime": "2025-04-07T23:03:08.900Z" }, "bandwidth": 10000, "availableBandwidth": 10000, "usedBandwidth": 0, "location": { "metroHref": "https://api.equinix.com/fabric/v4/metros/TY", "region": "APAC", "metroName": "Tokyo", "metroCode": "TY", "ibx": "TY4" }, "device": { "name": "sit-tb1-ty-a2.lab", "redundancy": { "priority": "SECONDARY" } }, "demarcationPointIbx": "TY4", "tetherIbx": "TY4", "redundancy": { "priority": "SECONDARY" }, "encapsulation": { "type": "QINQ", "tagProtocolId": 37120 }, "lagEnabled": false, "settings": { "buyout": false }, "physicalPorts": [ { "type": "XF_PHYSICAL_PORT", "id": 1362185, "state": "TO_BE_ADDED", "uuid": "01892489-ce9b-7f25-b1f5-d32a5ac6a423", "tether": { "crossConnectId": "ECX.05.00001836", "cabinetNumber": "Demarc", "systemName": "TY4:01:002181", "patchPanel": "PP:1240:1089399", "patchPanelPortA": "7", "patchPanelPortB": "8", "ibx": "TY4" }, "demarcationPoint": { "patchPanel": "PP:Demarc:00002181", "patchPanelName": "PP:Demarc:00002181", "patchPanelPortA": "5", "patchPanelPortB": "6", "ibx": "TY4" }, "operation": { "operationalStatus": "UP" } } ] }, { "href": "https://api.equinix.com/fabric/v4/ports/6f0f3015-2d51-4b6e-a98c-1defb4fe88f1", "type": "XF_PORT", "uuid": "6f0f3015-2d51-4b6e-a98c-1defb4fe88f1", "name": "200558-SY4-CX-PRI-02", "physicalPortsSpeed": 10000, "physicalPortsType": "10GBASE_LR", "project": { "projectId": "333cd592-1709-4238-bb0d-2c2b41896aa1" }, "package": { "code": "STANDARD" }, "state": "ACTIVE", "cvpId": "2000348", "operation": { "connectionCount": 1, "evplVCCount": 1, "accessVCCount": 0 }, "account": { "accountNumber": 200558, "accountName": "Gen-L2-Qa-01-Auto-200558", "orgId": 90946, "organizationName": "gen-l2-qa-01-auto-200551.", "ucmId": "2D26D682-B62E-495d-AFDF-698EC3B353F8", "globalCustId": "0017i000011X242AAC" }, "changeLog": { "createdDateTime": "2025-05-06T17:29:30.800Z", "updatedBy": "API", "updatedDateTime": "2025-05-06T17:29:40.300Z" }, "bandwidth": 10000, "availableBandwidth": 9500, "usedBandwidth": 500, "location": { "metroHref": "https://api.equinix.com/fabric/v4/metros/SY", "region": "APAC", "metroName": "Sydney", "metroCode": "SY", "ibx": "SY4" }, "device": { "name": "sit-tb1-sy-e1.lab", "redundancy": { "group": "1", "priority": "PRIMARY" } }, "demarcationPointIbx": "SY4", "tetherIbx": "SY4", "redundancy": { "priority": "PRIMARY" }, "encapsulation": { "type": "DOT1Q", "tagProtocolId": 33024 }, "lagEnabled": true, "settings": { "buyout": false }, "physicalPorts": [ { "type": "XF_PHYSICAL_PORT", "id": 1362737, "state": "ACTIVE", "uuid": "01892489-ce07-7962-b676-b1a4d8091515", "tether": { "crossConnectId": "22035616", "cabinetNumber": "Demarc", "systemName": "SY4:01:002204", "patchPanel": "PP:1240:1089399", "patchPanelPortA": "12", "patchPanelPortB": "14", "ibx": "SY4" }, "demarcationPoint": { "patchPanel": "PP:Demarc:00002204", "patchPanelName": "PP:Demarc:00002204", "patchPanelPortA": "17", "patchPanelPortB": "18", "ibx": "SY4" }, "operation": { "operationalStatus": "UP" } } ] } ] } ``` 响应字段的详细说明,请参阅《[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4/ports/searchports.md)》。