# ModifyPrivateConnectBandwidth

## 1. API Description

This API is used to modify bandwidth cap of a Layer 2 private connect.

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

* <mark style="color:blue;">Only operations on private connects in state of</mark> <mark style="color:blue;">`AVAILABLE`</mark> <mark style="color:blue;">are supported.</mark>
* <mark style="color:blue;">This API is an async API. A request ID is returned after the request is sent. However, it does not mean the modifying has been completed. The status of the private connect will be</mark> <mark style="color:blue;">`UPDATING`</mark> <mark style="color:blue;">during the modifying. You can call</mark> [<mark style="color:purple;">`DescribePrivateConnects`</mark>](https://docs.console.zenlayer.com/api-reference/networking/sdn/private-connect/describeprivateconnects) <mark style="color:blue;">to query the state of the private connect. If the state changes from</mark> <mark style="color:blue;">`UPDATING`</mark> <mark style="color:blue;">to</mark> <mark style="color:blue;">`AVAILABLE`</mark><mark style="color:blue;">, it means that the bandwidth cap has been modified successfully.</mark>
* <mark style="color:blue;">Any operations on the</mark> <mark style="color:blue;">private connects</mark> <mark style="color:blue;">are not allowed while modifying.</mark>
* <mark style="color:blue;">If a Layer 2 Private Connect contains a public cloud access point and the Cloud Connect access bandwidth has not been configured separately, this operation automatically adjusts it to the nearest cap higher than the new backbone bandwidth. You can configure Cloud Connect access bandwidth separately by calling the</mark> [<mark style="color:purple;">`ModifyCloudBandwidth`</mark>](https://docs.console.zenlayer.com/api-reference/networking/sdn/cloud/modifycloudbandwidth) <mark style="color:blue;">API.</mark>
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="194.22847827144875">Parameter Name</th><th width="120.15625">Required</th><th width="99">Type</th><th>Description</th></tr></thead><tbody><tr><td>privateConnectId</td><td>Yes</td><td>String</td><td>Private connect ID.</td></tr><tr><td>bandwidthMbps</td><td>Yes</td><td>Integer</td><td><p>Bandwidth cap of the private connect, ranging from 1 to 500.</p><p>Unit: Mbps</p></td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="195.51911009697662">Parameter Name</th><th width="86">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></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Modify the bandwidth cap of a private connect to 100 Mbps.**

```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. 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 Code

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="207.80618124672606">HTTP Status Code</th><th width="211">Error Code</th><th>Description</th></tr></thead><tbody><tr><td>400</td><td>INVALID_BANDWIDTH_EXCEED_LIMIT</td><td>Bandwidth cap exceeds the limit.</td></tr><tr><td>409</td><td>INVALID_PRIVATE_CONNECT_STATUS</td><td>Operations on private connects in state of <code>Inactive</code> are not supported.</td></tr></tbody></table>
