# Create Virtual Network Card - CreateNetworkInterface

## Overview

Create Virtual Network Card






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `CreateNetworkInterface`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.genesissai.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). |**Yes**|
| **VPCId** | string | Belonging VPCID |**Yes**|
| **SubnetId** | string | Subnet ID |**Yes**|
| **Name** | string | Name of the virtual network card, default is NetworkInterface |No|
| **PrivateIp.N** | string | Specify the private network IP. Currently, a network card only supports binding to one private network IP. |No|
| **SecurityGroupId** | string | Firewall GroupId, default: Web recommended firewall <br />Can be obtained from GroupId in DescribeSecurityGroupResponse |No|
| **Tag** | string | Business Group |No|
| **Remark** | string | Note |No|
| **SecurityMode** | int | Specify whether to use a security group or a firewall. Bind to a firewall when set to 0, and bind to a security group when set to 1. |No|
| **PrioritySecGroup.N.Priority** | int | Security Group Priority |No|
| **PrioritySecGroup.N.SecGroupId** | string | Security Group ID |No|
| **EipDirectMode** | boolean | Enable EIP Direct Connection, default is false |No|
| **EipDirectVersion** | int | enum <br />1: EIP network card visible<br />2: EIP Direct Access<br />Default is 1 |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|
| **NetworkInterface** | [*NetworkInterfaceInfo*](#networkinterfaceinfo) | If creation is successful, the information of the virtual network card will be returned. If creation fails, this parameter does not exist. |No|

#### Data Model


#### NetworkInterfaceInfo

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **InterfaceId** | string | Virtual Network Card Resource ID |**Yes**|
| **VPCId** | string | Belonging VPC |**Yes**|
| **SubnetId** | string | Subnet Ownership |**Yes**|
| **PrivateIpSet** | array[string] | Associate with the internal network IP. Currently, a network card only supports binding with one internal network IP. |**Yes**|
| **MacAddress** | string | Associate Mac |**Yes**|
| **Status** | int | Binding Status |**Yes**|
| **Name** | string | Virtual Network Card Name |No|
| **Netmask** | string | Private Network IP Mask |No|
| **Gateway** | string | Default Gateway |No|
| **AttachInstanceId** | string | Bind Instance Resource ID |No|
| **Default** | boolean | Is it the default network card bound to the instance? false: No true: Yes |No|
| **CreateTime** | int | Creation Time |No|
| **Remark** | string | Note |No|
| **Tag** | string | Business Group |No|
| **EipDirectMode** | boolean | Whether to enable EIP direct mode |No|
| **EipDirectVersion** | int | <br />EIP direct version |No|

## Example

### Request Example
    
```
{
	"Action": "CreateNetworkInterface",
        "Region": "cn-bj2",
	"ProjectId": "org-test",
	"VPCId": "uvnet-331hnn",
	"SubnetId": "subnet-hlfs4x",
	"Name": "helloucloud",
	"Tag": "test",
	"Remark": "test",
	"PrivateIp.0": "10.21.11.11",
	"SecurityGroupId": "0"
}
&SecurityMode=2
&PrioritySecGroup.N=UassEvha
&EipDirectMode=false
&PrioritySecGroup.N.SecGroupId=VoMaPJyE
&EipDirectVersion=6
```

### Response Example
    
```json
{
  "Action": "CreateNetworkInterfaceResponse",
  "NetworkInterface": {
    "AttachInstanceId": "",
    "CreateTime": 1513745006,
    "Default": false,
    "Gateway": "10.99.2.1",
    "InterfaceId": "uni-wbybfs",
    "MacAddress": "52:54:00:1F:A7:F7",
    "Name": "helloucloud",
    "Netmask": "255.255.255.0",
    "PrivateIpSet": [
      "10.99.2.81"
    ],
    "Remark": "test",
    "Status": 0,
    "SubnetId": "subnet-hlfs4x",
    "Tag": "test",
    "VPCId": "uvnet-331hnn"
  },
  "RetCode": 0
}
```





