> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/cn/sdn/cloud-router/describecloudrouteravailableports.md).

# DescribeCloudRouterAvailablePorts

## 1. 接口描述

本接口(DescribeCloudRouterAvailablePorts)用于查询可用端口。

{% hint style="info" %}
**注意事项**

* 目前只允许连通性状态为**ACTIVE**的数据中心端口加入到三层网络中。
  {% endhint %}

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称     | 必选 | 类型              | 描述                                       |
| -------- | -- | --------------- | ---------------------------------------- |
| portIds  | 否  | Array of String | <p>数据中心端口 ID 列表。</p><p>用于按数据中心端口过滤。</p>  |
| dcId     | 否  | String          | <p>数据中心 ID。</p><p>用于按数据中心过滤。</p>         |
| pageSize | 否  | Integer         | <p>返回的分页大小。</p><p>默认为 20，最大为 100。</p>    |
| pageNum  | 否  | Integer         | <p>返回的分页页码。</p><p>默认为 1。</p><p>默认值：1</p> |

## 3. 响应结果

| 参数名称       | 类型                                                                   | 描述                                                       |
| ---------- | -------------------------------------------------------------------- | -------------------------------------------------------- |
| requestId  | String                                                               | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |
| totalCount | Integer                                                              | 符合条件的数据中心端口总数量。                                          |
| dataSet    | Array of [PortInfo](/api-reference/cn/sdn/datastructure.md#portinfo) | 可加入网络的数据中心端口列表。                                          |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 获取可加入三层网络的数据中心端口列表。**

```json
POST /api/v2/sdn HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeCloudRouterAvailablePorts
<Common Request Params>

Request：
{
  "portIds": ["your-port-id"],
  "dcId": "SHA12",
  "pageSize": 20,
  "pageNum": 1
}

Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
     "requestId": "T98044459-95B2-477E-9A2F-00253A70CC6E",
     "dataSet": [
        {
            "loaStatus":"LOA_UPLOADED",
            "portStatus":"RUNNING",
            "portName":"portName",
            "portId":"your-port-id",
            "portType":"1G",
            "dcId":"SHA12",
            "cityName":"Shanghai",
            "areaName":"China",
            "dcName":"云立方",
            "businessEntityName":"Zenlayer Inc.",
            "connectionStatus":"ACTIVE",
            "createdTime":"2023-08-23T02:16:05Z",
            "expiredTime":"2024-08-23T02:16:05Z",
            "portRemarks":"portRemarks",
            "loaDownloadUrl":"https://oss.zenlayer.com/loa/your-loa-file.pdf",
            "period":12,
            "isCreateBusinessAllowed":true,
            "tags":{
                "tags":[
                    {"key":"env","value":"prod"}
                ]
            }
        }
     ],
     "totalCount": 1
  }
}
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的[开发工具集（SDK）](/api-reference/cn/api-introduction/toolkit.md)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](/api-reference/cn/api-introduction/instruction/commonerrorcode.md)

| HTTP状态码 | 错误码 | 说明 |
| ------- | --- | -- |
