# QueryPrivateConnectPrice

## 1. API Description

This API is used to query the price of a Layer 2 private connect.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="159.5987548828125">Parameter Name</th><th width="106.78479407747886">Required</th><th width="144.302490234375">Type</th><th>Description</th></tr></thead><tbody><tr><td>internetType</td><td>No</td><td><a href="../../datastructure#internettype">InternetType</a></td><td>Network billing model.<br>Default value: <code>ByBandwidth</code>.</td></tr><tr><td>bandwidthMbps</td><td>No</td><td>Integer</td><td>Bandwidth cap.<br>Default value: <code>10</code>.<br>Unit: Mbps.</td></tr><tr><td>endpointA</td><td>Yes</td><td><a href="../../datastructure#privateconnectendpointinfo">PrivateConnectEndpointInfo</a></td><td>Information of one access point of the private connect.</td></tr><tr><td>endpointZ</td><td>Yes</td><td><a href="../../datastructure#privateconnectendpointinfo">PrivateConnectEndpointInfo</a></td><td>Information of the other access point of the private connect.</td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="155.92755126953125">Parameter Name</th><th width="145.96761067708331">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 backbone bandwidth of the private connect.</td></tr><tr><td>stock</td><td>Integer</td><td><p>Stock of backbone bandwidth of the private connect.</p><p>Unit: <code>Mbps</code>.</p></td></tr><tr><td>endpointAPrice</td><td><a href="../../datastructure#privateconnectendpointprice">PrivateConnectEndpointPrice</a></td><td>Price of one access point of the private connect.</td></tr><tr><td>endpointZPrice</td><td><a href="../../datastructure#privateconnectendpointprice">PrivateConnectEndpointPrice</a></td><td>Price of the other access point of the private connect.</td></tr></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query the price of a Layer 2 private connect. The bandwidth is `10 Mbps`. One access point is a data center; the other access point is a public cloud.**

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

Request：
{
    "internetType": "ByBandwidth",
    "bandwidthMbps": 50,
    "endpointA": {
        "dcId": "822b9bd9-44f0-4279-a64d-568f5bc4a77b",
        "portType": "10G",
        "buildCrossConnectWithAssisted": true
    },
    "endpointZ": {
        "cloudType": "AWS",
        "dcId": "AMS1",
        "bandwidthMbps": 50,
        "vlanId": 1000,
        "cloudRegionId": null
    }
}

Response：
{
    "requestId": "T746CA1D1-339E-4344-939F-E089ABD246B7",
    "response": {
        "price": {
            "unitPrice": 27.750000,
            "originalPrice": null,
            "discountPrice": null,
            "discount": 100,
            "stepPrices": null,
            "discountUnitPrice": 27.750000,
            "chargeUnit": "DAY",
            "amountUnit": null
        },
        "requestId": "T746CA1D1-339E-4344-939F-E089ABD246B7",
        "endpointAPrice": {
            "crossConnectOneTimeConstructionPrice": {
                "unitPrice": 500.000000,
                "originalPrice": null,
                "discountPrice": null,
                "discount": null,
                "stepPrices": null,
                "discountUnitPrice": 500.000000,
                "chargeUnit": "MONTH",
                "amountUnit": null
            },
            "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
            }
        },
        "endpointZPrice": {
            "crossConnectOneTimeConstructionPrice": null,
            "price": {
                "unitPrice": 5.000000,
                "originalPrice": null,
                "discountPrice": null,
                "discount": 100,
                "stepPrices": null,
                "discountUnitPrice": 5.000000,
                "chargeUnit": "DAY",
                "amountUnit": null
            },
            "stock": null,
            "crossConnectPrice": null
        },
        "stock": 5000
    }
}
```

{% 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="166.9581298828125">HTTP Status Code</th><th width="217.5355224609375">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><tr><td>400</td><td>INVALID_PRIVATE_CONNECT_NOT_SUPPORT</td><td>Private connect is not supported for the current data center.</td></tr></tbody></table>
