# QueryDataCenterPortPrice

## 1. API Description

This API is used to query the price of a data center port.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="161.54296875">Parameter Name</th><th width="104.34482758620689">Required</th><th width="114">Type</th><th>Description</th></tr></thead><tbody><tr><td>dcId</td><td>Yes</td><td>String</td><td>Data center ID.<br>You can call <a href="../common/describedatacenters"><code>DescribeDataCenters</code></a> to get the latest data center list.</td></tr><tr><td>portType</td><td>Yes</td><td>String</td><td><p>Port specifications.</p><p>You can call <a href="../port/describedatacenterportprice"><code>DescribeDataCenterPortPrice</code></a> to get the latest port specification list.</p></td></tr><tr><td>buildCrossConnectWithAssisted</td><td>No</td><td>Boolean</td><td><p>Whether need <a href="https://docs.console.zenlayer.com/welcome/cloud-networking/get-started/create-a-port/create-a-cross-connect">Assisted Build</a> to build your cross connect.</p><p>If the value is <code>true</code>, the data center port price contains the cross connect fee and the one-time construction fee.</p><p>The default value is <code>false</code>, that is you need to build cross connect by yourself.</p></td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="182.3203125">Parameter Name</th><th width="100.65478958711435">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>price</td><td><a href="../../datastructure#price">price</a></td><td>Price of the data center port.</td></tr><tr><td>crossConnectPrice</td><td><a href="../../datastructure#price">price</a></td><td>Price of cross connect.</td></tr><tr><td>crossConnectOneTimeConstructionPrice</td><td><a href="../../datastructure#price">price</a></td><td>Price of one-time construction fee.</td></tr><tr><td>stock</td><td>Integer</td><td>Available stock of data center ports.</td></tr></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query the price of a data center port, and the cross connect is built on user's own.**

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

Request：
{
    "dcId": "SIN1",
    "portType": "10G",
    "buildCrossConnectWithAssisted": false
}

Response：
{   
  "requestId": "TDB181167-C39F-4C3E-8E88-B8FDE755FDC0",
  "response": {
    "requestId":"TDB181167-C39F-4C3E-8E88-B8FDE755FDC0",
    "price":        {
            "unitPrice":1.65,
            "originalPrice":null,
            "discountPrice":null,
            "discount":100,
            "stepPrices":null,
            "discountUnitPrice":1.65,
            "chargeUnit":"DAY"
        },
    "stock": 100
  }
}
```

{% 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

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/api-reference/api-introduction/instruction/commonerrorcode).​

<table><thead><tr><th width="175.32942708333331">HTTP Status Code</th><th width="321.1796875">Error Code</th><th>Description</th></tr></thead><tbody><tr><td>404</td><td>INVALID_DATACENTER_NOT_FOUND</td><td>Data center does not exist.</td></tr></tbody></table>
