Updated on 2024-04-18 GMT+08:00

Updating Bandwidths in Batches

Function

This API is used to update bandwidths in batches. This API is not applicable to shared bandwidths and yearly/monthly bandwidths.

URI

PUT /v2/{project_id}/batch-bandwidths/modify

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

bandwidths

Yes

Array of ModifyBandwidthOption objects

Update bandwidths.

Table 3 ModifyBandwidthOption

Parameter

Mandatory

Type

Description

id

Yes

String

  • Bandwidth ID, which uniquely identifies a bandwidth

Maximum length: 36

name

No

String

The name of the bandwidth. The value can contain 1 to 64 characters, including letters, digits, underscores (_), and hyphens (-). If the value is left blank, the name of the bandwidth is not changed. Either parameter name or size must be specified.

Minimum length: 1

Maximum length: 64

size

No

Integer

The bandwidth size, in Mbit/s. The value ranges from 1 Mbit/s to 2,000 Mbit/s by default. (The specific range may vary by the configuration in each region. You can see the available bandwidth range on the management console.) If the parameter is not specified, the bandwidth size is not changed. Either parameter name or size must be specified. If a decimal fraction (for example 10.2) or a character string (for example 10) is specified, the value will be automatically converted to an integer. The minimum increment for bandwidth adjustment varies with the bandwidth range. The minimum increment is 1 Mbit/s if the allowed bandwidth ranges from 0 Mbit/s to 300 Mbit/s. The minimum increment is 50 Mbit/s if the allowed bandwidth ranges 300 Mbit/s to 1,000 Mbit/s. The minimum increment is 500 Mbit/s if the allowed bandwidth is greater than 1,000 Mbit/s.

charge_mode

No

String

Whether the bandwidth is billed by traffic, bandwidth, or 95th percentile bandwidth (enhanced). The value can be bandwidth, traffic, or 95peak_plus (billed by enhanced 95th percentile bandwidth). If the value is an empty character string or no value is specified, value bandwidth is used. Only the shared bandwidth supports 95peak_plus (billed by enhanced 95th percentile bandwidth). If you choose to be billed by 95th percentile bandwidth (enhanced), you need to specify the guaranteed bandwidth percentage. The default value is 20%.

The value can be:

  • bandwidth
  • traffic
  • 95peak_plus

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

success_resources

Array of SuccessResources objects

Successful resources

failure_resources

Array of FailureResources objects

Failed resources

Table 5 SuccessResources

Parameter

Type

Description

id

String

  • ID of the bandwidth that is successfully updated.

Minimum length: 1

Maximum length: 36

Table 6 FailureResources

Parameter

Type

Description

id

String

  • ID of the bandwidth that fails to be updated.

Minimum length: 1

Maximum length: 36

code

String

  • Error code

Minimum length: 1

Maximum length: 36

message

String

  • Error message

Minimum length: 1

Maximum length: 256

Example Request

Update bandwidths in batches.

{
  "bandwidths" : [ {
    "id" : "837d84a0-b940-4401-9477-4a99de1979a7",
    "name" : "bandwidth123",
    "size" : 5
  }, {
    "id" : "f2549bed-c419-4f58-9609-7ade104772bb",
    "name" : "bandwidth123",
    "size" : 5
  } ]
}

Example Response

Status code: 200

Normal response to GET and PUT operations

{
  "success_resources" : [ {
    "id" : "837d84a0-b940-4401-9477-4a99de1979a7"
  } ],
  "failure_resources" : [ {
    "id" : "f2549bed-c419-4f58-9609-7ade104772bb",
    "code" : "VPC.0319",
    "message" : "updateBandwidth bandwidth failed. the bandwidth is share bandwidth."
  } ]
}

Status Codes

Status Code

Description

200

Normal response to GET and PUT operations

Error Codes

See Error Codes.