# Obtain Subnet Information - DescribeSubnet

## Overview

Obtain Subnet Information






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `DescribeSubnet`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.sigcalcloud.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region. See [List of Regions and Availability Zones](/docs/api/summary/regionlist) |**Yes**|
| **ProjectId** | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the [GetProjectList interface](/docs/api/summary/get_project_list). |No|
| **SubnetIds.N** | string | Array of subnet IDs, suitable for querying multiple subnet information at once. |No|
| **SubnetId** | string | Subnet id, applicable for querying information of one subnet at a time. |No|
| **RouteTableId** | string | Routing Table Id |No|
| **VPCId** | string | VPC Resource ID |No|
| **Tag** | string | Business group name, default is Default |No|
| **Offset** | int | Offset, default is 0 |No|
| **Limit** | int | List length, default is 20 |No|
| **ShowAvailableIPs** | boolean | Whether to return the number of available IPs in the subnet, true for yes, false for no, not returned by default. |No|
| **IgnoreResource** | boolean | Default is false<br />For console calls, it can be set to true, avoiding queries for non-essential console data |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **TotalCount** | int | Total number of subnets |**Yes**|
| **DataSet** | array[[*SubnetInfo*](#subnetinfo)] | Array of subnet information, see SubnetInfo for specific resources |**Yes**|

#### Data Model


#### SubnetInfo

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Zone** | string | Availability Zone Name |No|
| **IPv6Network** | string | IPv6 Subnet |No|
| **VPCId** | string | VPCId |No|
| **VPCName** | string | VPC Name |No|
| **SubnetId** | string | Subnet Id |No|
| **SubnetName** | string | Subnet Name |No|
| **Remark** | string | Note |No|
| **Tag** | string | Business Group |No|
| **SubnetType** | int | Subnet Type |No|
| **Subnet** | string | Subnet Segment |No|
| **Netmask** | string | Subnet Mask |No|
| **Gateway** | string | Subnet Gateway |No|
| **CreateTime** | int | Creation Time |No|
| **HasNATGW** | boolean | Is there a natgw? |No|
| **RouteTableId** | string | Routing Table Id |No|
| **AvailableIPs** | int | Available IP Quantity |No|
| **AvailableIPv6Count** | int | Available IPv6 Count |No|

## Example

### Request Example
    
```
https://api.sigcalcloud.com/?Action=DescribeSubnet
&ProjectId=org-XXXX
&Region=cn-sh2
&SubnetId=subnet-XXX
&VPCId=uvnet-XXXX
&Tag=tag
&Offset=0
&Limit=20
&RouteTableId=KbKrefnV
&ShowAvailableIPs=false
&IgnoreResource=true
```

### Response Example
    
```json
{
  "Action": "DescribeSubnetResponse",
  "DataSet": [
    {
      "CreateTime": 1528353483,
      "Gateway": "172.16.XX.1",
      "HasNATGW": false,
      "Name": "test-s1",
      "Netmask": "24",
      "Remark": "test",
      "RouteTableId": "routetable-XXXX",
      "Subnet": "172.16.XXX.0",
      "SubnetId": "subnet-XXXXX",
      "SubnetName": "test-s1",
      "SubnetType": 2,
      "Tag": "Default",
      "VPCId": "uvnet-XXXX",
      "VPCName": "test",
      "VRouterId": "Default_VRouter",
      "Zone": "cn-sh2-01"
    }
  ],
  "RetCode": 0,
  "TotalCount": 1
}
```





