# ChangeNicNetworkType

## 1. API Description

This API (ChangeNicNetworkType) is used to modify the network interface mode of the instance.

#### Prerequisites

* Query images: call[ `DescribeImages`](https://docs.console.zenlayer.com/api-reference/compute/zec/image/describeimages) to check information on image.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="211">Parameter Name</th><th width="160">Required</th><th width="120">Type</th><th>Description</th></tr></thead><tbody><tr><td>instanceId</td><td>Yes</td><td>String</td><td>ID of the instance.</td></tr><tr><td>nicNetworkType</td><td>Yes</td><td>String</td><td>Network interface mode.</td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="213">Parameter Name</th><th width="113">Type</th><th>Description</th></tr></thead><tbody><tr><td>requestId</td><td>String</td><td>The unique request ID, which is returned for each request. RequestId is required for locating a problem.</td></tr></tbody></table>

## 4. Code Example

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type                                                                                                   | Description             |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------ | ----------------------- |
| instanceId     | Yes      | String                                                                                                 | ID of the instance.     |
| nicNetworkType | Yes      | [NicNetworkType](https://docs.console.zenlayer.com/api-reference/compute/datastructure#nicnetworktype) | Network interface mode. |

## 3. Output Parameters

| Parameter Name | Type   | Description                                                                                                           |
| -------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| requestId      | String | <p>The unique request ID, which is returned for each request.</p><p>RequestId is required for locating a problem.</p> |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Modify the network interface mode of the instance.**

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

Request:
{
  "instanceId": "instanceId1",
  "nicNetworkType": "FailOver"
}

Response:
{
  "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F"
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk)，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](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode).

| HTTP Status Code | Error Code                                                    | Description                                             |
| ---------------- | ------------------------------------------------------------- | ------------------------------------------------------- |
| 400              | OPERATION\_DENIED\_INSTANCE\_EXIST\_EXTRA\_NIC                | The instance has multiple vNICs, operation not allowed. |
| 400              | OPERATION\_DENIED\_INSTANCE\_NIC\_NETWORK\_TYPE\_NOT\_SUPPORT | Unsupported vNIC mode.                                  |
| 400              | OPERATION\_DENIED\_INSTANCE\_STATUS\_NOT\_SUPPORT             | Current instance state does not allow this operation.   |
