# DescribePrivateConnectAvailablePorts

## 1. API Description

This API is used to query available ports that can be added into a Layer 2 private connect.

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

<mark style="color:blue;">Only ports in state of</mark> <mark style="color:blue;">`ACTIVE`</mark> <mark style="color:blue;">can be added into a Layer 2 private connect currently.</mark>
{% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="191.73684210526318">Parameter Name</th><th width="116">Required</th><th width="151">Type</th><th>Description</th></tr></thead><tbody><tr><td>portIds</td><td>No</td><td>Array of String</td><td>Port ID.</td></tr><tr><td>dcId</td><td>No</td><td>String</td><td>Data center ID.</td></tr><tr><td>pageNum</td><td>No</td><td>Integer</td><td><p>Number of pages returned.</p><p>Default value: 1.</p></td></tr><tr><td>pageSize</td><td>No</td><td>Integer</td><td><p>Number of items in the current page result.</p><p>Default value: 20;</p><p>Maximum value: 1000.</p></td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="196.33333333333331">Parameter Name</th><th width="177.35242548217423">Type</th><th>Description</th></tr></thead><tbody><tr><td>requestId</td><td>String</td><td>The unique request ID, which is returned for each request. RequestId is required for locating a problem.</td></tr><tr><td>dataSet</td><td>Array of <a href="../../datastructure#portinfo">PortInfo</a></td><td>Information on ports.</td></tr><tr><td>totalCount</td><td>Integer</td><td>Number of ports meeting the filtering conditions.</td></tr></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query available ports that can be added into a Layer 2 private connect.**

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

Request：
{}

Response：
{   
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
     "requestId": "T98044459-95B2-477E-9A2F-00253A70CC6E",
     "dataSet": [
     {
            "portId":"your-port-id",
            "portName":"your-port-name",
            "portRemarks":"your-port-remark",
            "portType":"1G",
            "dcId":"SIN1",
            "dcName":"AP-Singapore1",
            "cityName":"Singapore",
            "areaName":"Asia Pacific",
            "connectionStatus":"ACTIVE",
            "portStatus":"RUNNING",
            "loaStatus":"LOA_NOT_UPLOAD",
            "createdTime":"YYYY-MM-DDThh:mm:ssZ",
            "expiredTime":"YYYY-MM-DDThh:mm:ssZ",
            "portChargeType":"POSTPAID"
        }
     ],
     "totalCount": 1
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk) to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

No error codes related to the API business logic. For other error codes, see [Common Error Codes](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode).​
