> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/cn/sdn/private-connect/inquirycreateprivateconnectprice.md).

# InquiryCreatePrivateConnectPrice

## 1. 接口描述

本接口(InquiryCreatePrivateConnectPrice)用于二层网络专线询价。

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称            | 必选 | 类型                                                                                | 描述                                                             |
| --------------- | -- | --------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| endpointA       | 是  | [CreateEndpointParam](/api-reference/cn/sdn/datastructure.md#createendpointparam) | 二层网络专线一端的连接点（A）。                                               |
| endpointZ       | 是  | [CreateEndpointParam](/api-reference/cn/sdn/datastructure.md#createendpointparam) | 二层网络专线另一端的连接点（Z）。                                              |
| bandwidthMbps   | 否  | Integer                                                                           | <p>二层网络专线最大带宽限制。</p><p>默认为 1，单位：Mbps。</p><p>可选值范围：\[10, +)</p> |
| internetType    | 否  | [InternetType](/api-reference/cn/sdn/datastructure.md#internettype)               | <p>网络计费方式。</p><p>默认值：ByBandwidth</p>                           |
| commitBandwidth | 否  | Integer                                                                           | <p>保底带宽。</p><p>单位：Mbps。</p><p>可选值范围：\[1, +)</p>                |

## 3. 响应结果

| 参数名称                    | 类型                                                            | 描述                                                       |
| ----------------------- | ------------------------------------------------------------- | -------------------------------------------------------- |
| requestId               | String                                                        | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |
| privateConnectPrice     | [PriceItem](/api-reference/cn/sdn/datastructure.md#priceitem) | 二层网络专线带宽价格。                                              |
| privateConnectBandwidth | Integer                                                       | 二层网络专线带宽。                                                |
| endpointAPrice          | [PriceItem](/api-reference/cn/sdn/datastructure.md#priceitem) | A 端连接点的建设价格。                                             |
| endpointABandwidth      | Integer                                                       | A 端连接点带宽。                                                |
| endpointZPrice          | [PriceItem](/api-reference/cn/sdn/datastructure.md#priceitem) | Z 端连接点的建设价格。                                             |
| endpointZBandwidth      | Integer                                                       | Z 端连接点带宽。                                                |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 对1个二层网络专线（A 和 Z 都是数据中心端口）进行询价,带宽为默认1Mbps。**

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

Request：
{
    "endpointA": {
        "portId": "your-port-Id"
    },
    "endpointZ": {
        "portId": "your-port-Id-2"
    }
}

Response：
{
  "requestId": "TDB181167-C39F-4C3E-8E88-B8FDE755FDC0",
  "response": {
    "requestId":"TDB181167-C39F-4C3E-8E88-B8FDE755FDC0",
    "privateConnectPrice": {
            "unitPrice":1.65,
            "originalPrice":null,
            "discountPrice":null,
            "discount":100,
            "stepPrices":null,
            "discountUnitPrice":1.65,
            "chargeUnit":"DAY",
            "amountUnit":"Mbps",
            "category":"STANDARD"
        },
    "privateConnectBandwidth":1,
    "endpointAPrice": {
            "unitPrice":0,
            "originalPrice":null,
            "discountPrice":null,
            "discount":100,
            "stepPrices":null,
            "discountUnitPrice":0,
            "chargeUnit":"DAY",
            "amountUnit":"Mbps",
            "category":"STANDARD"
        },
    "endpointABandwidth":1,
    "endpointZPrice": {
            "unitPrice":0,
            "originalPrice":null,
            "discountPrice":null,
            "discount":100,
            "stepPrices":null,
            "discountUnitPrice":0,
            "chargeUnit":"DAY",
            "amountUnit":"Mbps",
            "category":"STANDARD"
        },
    "endpointZBandwidth":1
  }
}
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的[开发工具集（SDK）](/api-reference/cn/api-introduction/toolkit.md)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](/api-reference/cn/api-introduction/instruction/commonerrorcode.md)

| HTTP状态码 | 错误码                           | 说明             |
| ------- | ----------------------------- | -------------- |
| 400     | INVALID\_GOOGLE\_PAIRING\_KEY | Google 配对密钥无效。 |
| 404     | INVALID\_PORT\_NOT\_FOUND     | 数据中心端口不存在。     |
| 400     | INVALID\_PORT\_STATUS         | 数据中心端口状态无效。    |
| 400     | INVALID\_ENDPOINT\_PARAMETER  | 无法根据参数推断连接点类型。 |
