# QueryDataCenterPortPrices

## 1. API Description

This API is used to batch query the price of data center ports.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="153.96307373046875">Parameter Name</th><th width="105.13354896029136">Required</th><th width="90.8792724609375">Type</th><th>Description</th></tr></thead><tbody><tr><td>dcIds</td><td>Yes</td><td>Array of String</td><td><p>Data center ID.<br>You can call <a href="../common/describedatacenters"><code>DescribeDataCenters</code></a> to get the latest data center list.</p><p>You can query up to 100 IDs in each request.</p></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="156.05902099609375">Parameter Name</th><th width="178.20833333333331">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>prices</td><td>Array of <a href="../../datastructure#datacenterportprice">DatacenterPortPrice</a></td><td>Price of data center ports.</td></tr></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Batch query the price of data center ports, and the cross connect is built with our assistance.**

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

Request：
{
    "dcIds": [
        "822b9bd9-44f0-4279-a64d-568f5bc4a77b",
        "eab1caab-4970-4d34-9e79-c75ecd7eb1ee"
    ],
    "portType": "10G",
    "buildCrossConnectWithAssisted": true
}

Response：
{
    "requestId": "TFAC9662F-EE4D-4CF5-A6D1-CA51AB0A8D54",
    "response": {
        "requestId": "TFAC9662F-EE4D-4CF5-A6D1-CA51AB0A8D54",
        "prices": [
            {
                "crossConnectOneTimeConstructionPrice": null,
                "dcId": "eab1caab-4970-4d34-9e79-c75ecd7eb1ee",
                "price": {
                    "unitPrice": 0.750000,
                    "originalPrice": null,
                    "discountPrice": null,
                    "discount": 100,
                    "stepPrices": null,
                    "discountUnitPrice": 0.750000,
                    "chargeUnit": "DAY",
                    "amountUnit": null
                },
                "stock": 13,
                "crossConnectPrice": null
            },
            {
                "crossConnectOneTimeConstructionPrice": {
                    "unitPrice": 500.000000,
                    "originalPrice": null,
                    "discountPrice": null,
                    "discount": null,
                    "stepPrices": null,
                    "discountUnitPrice": 500.000000,
                    "chargeUnit": "MONTH",
                    "amountUnit": null
                },
                "dcId": "822b9bd9-44f0-4279-a64d-568f5bc4a77b",
                "price": {
                    "unitPrice": 0.550000,
                    "originalPrice": null,
                    "discountPrice": null,
                    "discount": 100,
                    "stepPrices": null,
                    "discountUnitPrice": 0.550000,
                    "chargeUnit": "DAY",
                    "amountUnit": null
                },
                "stock": 11,
                "crossConnectPrice": {
                    "unitPrice": 15.000000,
                    "originalPrice": null,
                    "discountPrice": null,
                    "discount": 100,
                    "stepPrices": null,
                    "discountUnitPrice": 15.000000,
                    "chargeUnit": "MONTH",
                    "amountUnit": null
                }
            }
        ]
    }
}
```

{% 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="168.32183837890625">HTTP Status Code</th><th width="319.401123046875">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>
