BatchAssignNetworkInterfaceIpv4

BatchAssignNetworkInterfaceIpv4

1. API Description

This API is used to batch assign the private IPv4 addresses to the vNIC.

Note

  • vNIC state must be AVAILABLE or USED.

  • If any of the private IPv4 addresses is illegal, the operation will fail immediately.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

nicId

Yes

String

ID of the vNIC.

ipAddresses

Yes

Array of String

List of private IP addresses.

Each IP must fall within the IP range of the associated subnet and must not be the gateway, broadcast, or network address.

ipAddressCount

No

Integer

Number of additional private IPs to assign. Either this field or ipAddresses must be specified. If both are provided, ipAddresses takes precedence. Valid range: [1, +).

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

ipAddresses

Array of String

Assigned private IPs.

4. Code Example

Batch bind the private IPv4 to the vNIC.

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

Request:
{
  "nicId": "<nicId>",
  "ipAddresses": ["10.0.0.3", "10.0.0.4"]
}

Response:
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "ipAddresses": ["10.0.0.3", "10.0.0.4"]
  }
}
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs 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.

HTTP Status Code
Error Code
Description

400

INVALID_NIC_STATUS

vNIC state is not supported.

400

OPERATION_DENIED_SUBNET_TYPE_NOT_SUPPORT_IPV4

Subnet type does not support IPv4.

409

INVALID_SUBNET_PRIVATE_IPV4_IN_USED

Private IPv4 is occupied.

400

INVALID_IP_OUT_OF_RANGE

Private IPv4 does not belong to the IP range of the subnet.

400

INVALID_IP_NETWORK_ADDRESS

Network address is not supported.

400

INVALID_IP_BROADCAST_ADDRESS

Broadcast address is not supported.

400

INVALID_IP_FIRST_ADDRESS

Gateway address is not supported.

400

OPERATION_DENIED_SUBNET_IP_INSUFFICIENT

Insufficient available IPs in the subnet.

400

INVALID_PARAMETER_PRIVATE_IP_ILLEGAL

Invalid private IP address.

400

OPERATION_DENIED_NIC_ATTACH_LAN_IP_EXCEED_LIMIT

The number of private IPs on the vNIC exceeds the upper limit.

Last updated