Delete Subnets

Last updated: 2018-06-25 18:17:48

PDF

1. API Description

This API (DeleteSubnet) is used to delete subnets.
Domain for API request:vpc.api.qcloud.com

You need to remove all resources (including CVMs, cloud load balancers, cloud data, noSql and so on) under the subnet before you can delete it.

2. Input Parameters

The following request parameter list only provides API request parameters. Common request parameters need to be added when the API is called. For more information, refer to Common Request Parameters. The Action field for this API is DeleteSubnet.

Parameter Name Required Type Description
vpcId Yes String Virtual private cloud ID of the subnet, which can be vpcId or unVpcId. unVpcId is recommended. For example: vpc-kd7d06of. You can query this through API DescribeVpcEx.
subnetId Yes String ID of the subnet to be deleted. Both subnetId and unSubnetId are supported. unSubnetId is recommended. For example: subnet-k20jbhp0. You can query this through the API DescribeSubnetEx.

3. Output Parameters

Parameter Name Type Description
code Int Common error code; 0: Succeeded; other values: Failed. For more information, please refer to Common Error Codes on the Error Code page.
message String Module error message description depending on API.

4. Error Code Table

The following error code list only provides the business logic error codes for this API. For additional common error codes, refer to VPC Error Codes.

Error Code Description
InvalidVpc.NotFound Invalid VPC. VPC resource does not exist. Please verify that the resource information you entered is correct. You can query the VPC via the API DescribeVpcEx.
InvalidSubnet.NotFound Invalid subnet. Subnet resource does not exist. Please verify that the resource information you entered is correct. You can query subnets via the API DescribeSubnetEx.
InvalidSubnet.CannotDelete Cannot delete the subnet because there are still resources under this subnet.

5. Example

Input

  https://vpc.api.qcloud.com/v2/index.php?Action=DeleteSubnet
    &<Common request parameters>
  &vpcId=vpc-kd7d06of
  &subnetId=subnet-k20jbhp0

Output

{
    "code": 0,
    "message": ""
}