# ModifyPrivateConnectBandwidth

## 1. 接口描述

调用本接口用于修改一条二层网络专线的带宽限速。

{% hint style="info" %}
**注意事项**

* 仅当二层网络专线状态为**AVAILABLE**时，才能进行带宽限速的变更操作。
* 本接口为异步接口，此时带宽修改操作并未立即完成。在此期间实例的状态将会处于**UPDATING**，结果可以通过调用[`DescribePrivateConnects`](https://docs.console.zenlayer.com/api-reference/cn/networking/sdn/private-connect/describeprivateconnects) 接口查询，如果状态(privateConnectStatus)由 **UPDATING**(修改中)变为**AVAILABLE**(可用)，则代表带宽更新成功。
* 在变更带宽期间，不得对该二层网络专线进行其他任何操作。
* 如果二层网络专线的接入点包含云连接，并且云连接未自定义过带宽限速，该操作会自动将云连接的带宽限速设置为与二层网络专线骨干带宽限速最接近的带宽阶梯。可以通过调用[`ModifyCloudBandwidth`](https://docs.console.zenlayer.com/api-reference/cn/networking/sdn/cloud/modifycloudbandwidth) 自定义修改云连接的带宽限速。
  {% endhint %}

## 2. 请求参数

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

<table><thead><tr><th width="238">参数名称</th><th width="96.15625">必选</th><th width="108">类型</th><th>描述</th></tr></thead><tbody><tr><td>privateConnectId</td><td>是</td><td>String</td><td>二层网络专线ID。</td></tr><tr><td>bandwidthMbps</td><td>是</td><td>Integer</td><td>需要修改的带宽限速。<br>大小在1-500。单位：Mbps。</td></tr></tbody></table>

## 3. 响应结果

<table><thead><tr><th width="136.33333333333331">参数名称</th><th width="248">类型</th><th>描述</th></tr></thead><tbody><tr><td>requestId</td><td>String</td><td><p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 RequestId。</p></td></tr></tbody></table>

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 修改专线带宽为100Mbps**

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

Request：
{
    "privateConnectId": "your-private-connect-id",
    "bandwidthMbps": 100
}

Response：
{   
  "requestId": "T98044459-95B2-477E-9A2F-00253A70CC6E",
  "response": {
     "requestId": "T98044459-95B2-477E-9A2F-00253A70CC6E"，
  }
}
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

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

## 6. 错误码

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

<table><thead><tr><th width="236.33333333333331">HTTP状态码</th><th>错误码</th><th>说明</th></tr></thead><tbody><tr><td>400</td><td>INVALID_BANDWIDTH_EXCEED_LIMIT</td><td>带宽大小超限制。</td></tr><tr><td>409</td><td>INVALID_PRIVATE_CONNECT_STATUS</td><td>状态不可用，无法进行操作。</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/api-reference/cn/networking/sdn/private-connect/modifyprivateconnectbandwidth.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
