Query Subnet Details

Last updated: 2020-06-04 17:06:14


    This is a legacy API which has been hidden and will no longer be updated. We recommend using the new VPC API 3.0 which is standardized and faster.

    1. API Description

    This API (DescribeSubnet) is used to query subnet attribute.
    Domain for API request:vpc.api.qcloud.com

    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 DescribeSubnet.

    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-piztzbpy. Can be queried via the API DescribeVpcEx.
    subnetId Yes String Subnet ID assigned by the system. Both subnetId and unSubnetId are supported. unSubnetId is recommended. For example: subnet-piztzbpy.

    3. Output Parameters

    Parameter Name Type Description
    code Int Error code, 0: Succeeded, other values: Failed.
    message String Error message.
    subnetId String Subnet ID assigned by the system. For example: subnetId_GZ_23.
    subnetName String Subnet name.
    subnetCreateTime String Subnet creation time, for example: 2015-10-30 16:10:49.
    cidrBlock String Subnet network segment, for example:
    routeTableId String ID of the default routing table that is bound to the subnet. For example: gz_rtb_8751.
    zoneId String ID of the availability zone in which the subnet resides. For example: 200001.
    totalIPNum Int Number of IPs within the subnet.
    availableIPNum Int Number of available IPs within the subnet.

    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.

    5. Example


      &<Common request parameters>


        "code": 0,
        "message": "",
        "subnetId": "gz_subnet_18712",
        "subnetName": "apiSubnetTest",
        "subnetCreateTime": "2015-10-30 16:10:49",
        "routeTableId": "gz_rtb_8747",
        "cidrBlock": "\/25",
        "zoneId": 800001,
        "totalIPNum": 125,
        "availableIPNum": 125

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback