# DescribePorts

## 1. API Description

This API is used to query port list.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="168.23091133004928">Parameter Name</th><th width="107">Required</th><th width="100">Type</th><th>Description</th></tr></thead><tbody><tr><td>portIds</td><td>No</td><td>Array of String</td><td><p>Port ID list.</p><p>Up to 100 characters in length are allowed.</p></td></tr><tr><td>dcId</td><td>No</td><td>String</td><td><p>Code of data center.</p><p>To obtain code, you can call <a href="../common/describedatacenters"><code>DescribeDataCenters</code></a>, and find <code>dcId</code> in the response.</p></td></tr><tr><td>portName</td><td>No</td><td>String</td><td><p>Port name.</p><p>Up to 255 characters in length are allowed with fuzzy search supported and and not case-sensitive.</p></td></tr><tr><td>portRemarks</td><td>No</td><td>String</td><td><p>Note of port.</p><p>Up to 255 characters in length are allowed with fuzzy search supported and and not case-sensitive.</p></td></tr><tr><td>cityName</td><td>No</td><td>String</td><td><p>City name.</p><p>Up to 64 characters in length are allowed with fuzzy search supported and and not case-sensitive.</p></td></tr><tr><td>tagKeys</td><td>No</td><td>Array of String</td><td><p>Query using tag keys.</p><p>A maximum of 20 tag keys can be used.</p></td></tr><tr><td>tags</td><td>No</td><td>Array of <a href="../../datastructure#tag">Tag</a></td><td><p>Query using tags.</p><p>A maximum of 20 tags can be used.</p></td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="188.73509933774835">Parameter Name</th><th width="177">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>totalCount</td><td>Integer</td><td>Number of ports meeting the filtering conditions.</td></tr><tr><td>dataSet</td><td>Array of <a href="../../datastructure#portinfo">PortInfo</a></td><td>Information on ports.</td></tr></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query port list.**

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

Request: {
  "portIds": ["your-port-id"]
}

Response: {
    "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
    "response": {
        "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
        "totalCount": 1,
        "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"
        }]
    }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

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

## 6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see [Common Error Codes](https://docs.console.zenlayer.com/test/ci-develop-en/api-introduction/instruction/commonerrorcode).​

<table><thead><tr><th width="201.33333333333331">HTTP Status Code</th><th width="313">Error Code</th><th>Description</th></tr></thead><tbody><tr><td>7105</td><td>SELF_SERVICE_PORT_NOT_FOUND</td><td>Port not found.</td></tr></tbody></table>
