# API reconfigures VM's Networks

## <mark style="color:green;">**Overview**</mark> <a href="#overview" id="overview"></a>

In this manual, you will find detailed information on how to prepare information, get VM’s network information, and reconfigure VM’s networks.

## <mark style="color:green;">**Procedure**</mark> <a href="#procedure" id="procedure"></a>

{% stepper %}
{% step %}

#### **Step 1: Prepare Information**

Login IAM portal -> vCD portal: collect the information

**{{vcd\_url}}**

<figure><img src="/files/Y7kJzy5K5HCTTlGa9ERf" alt=""><figcaption></figcaption></figure>

**{{vm-uuid}}:** select VM -> take a look vm uuid on url<br>

<figure><img src="/files/2T3sqUULPV3iCdXa1JK6" alt=""><figcaption></figcaption></figure>

**{{network\_name}}**: Select Networking -> Networks -> Copy the Network name<br>

<figure><img src="/files/xfBlpjNpWuVyXjmNyDn0" alt=""><figcaption></figcaption></figure>

**{{Bearer Token}}:** Please follow the **“API token login”** document
{% endstep %}

{% step %}
**Step 2: Get VM’s network information**

* GET https\://{{vcd\_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/networkCards
* Authorization: {{Bearer Token}}
* Headers:

\- ‘Accept’: \*/\*;version=37.2

\- ‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml

<figure><img src="/files/guaxnTqbXVbZkFFDhOfZ" alt=""><figcaption></figcaption></figure>

* SEND request.

Copy **Response Body**
{% endstep %}

{% step %}

#### Step &#x33;**: Reconfig VM’s networks**

* PUT https//{{vcd\_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/networkCards
* Authorization: {{Bearer Token }}
* Headers:

\- 'Accept’: \*/\*;version=37.2

\- ‘Content-type’: application/vnd.vmware.vcloud.rasdItemsList+xml; charset=ISO-8859-1

Body: *{{select raw -> copy and paste* *response body from Get VM’s networks information }}*

Ex:

```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RasdItemsList xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"
…………………………………..
………………………………….
    <Link rel="edit" href="https://iaas-hcmc02.higiocloud.vn/api/vApp/vm-6cc0d2ef-6823-421a-bed5-8bb0f92a7bca/virtualHardwareSection/networkCards" type="application/vnd.vmware.vcloud.rasdItemsList+json"/>
    <Item>
        <rasd:Address>00:50:56:02:10:2c</rasd:Address>
        <rasd:AddressOnParent>0</rasd:AddressOnParent>
        <rasd:AllocationUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
        <rasd:AutomaticDeallocation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rasd:ConfigurationName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rasd:Connection xmlns:ns10="http://www.vmware.com/vcloud/v1.5" ns10:ipAddressingMode="Manual" ns10:ipAddress="10.10.11.20" ns10:primaryNetworkConnection="true">10.10.11.0/24</rasd:Connection>
        <rasd:ConsumerVisibility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        …………………………………………………………………….
        <rasd:ResourceSubType>VMXNET3</rasd:ResourceSubType>
        <rasd:ResourceType>10</rasd:ResourceType>
        <rasd:VirtualQuantity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
        <rasd:Weight xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
    </Item>
</RasdItemsList>
```

\=====================================================================

Find word :

<mark style="color:red;">ns10:ipAddressingMode</mark> and edit the value in “ ” (network mode: “DHCP”, “Pool”, “Manual”)

\+ DHCP: Please setup DHCP pool on your network -> The P Management

\+ Pool: Please setup Static IP pools on yoursetork -> IP Management

<mark style="color:red;">ns10:ipAddress</mark> and edit the value in “” (“VM ipv4 address”) – **no need if using DHCP or Pool**

<mark style="color:red;">ns10:primaryNetworkConnection</mark> and edit the value in “” (paste network name <mark style="color:green;">{{netwok\_name}}</mark> )

* SEND request.
  {% endstep %}

{% step %}

#### **Step 4: Verify**

* **Get VM’s network information.**

GET https\://{{vcd\_url}}/api/vApp/{{vm-uuid}}/virtualHardwareSection/networkCards

* **Check on the vCD portal**

Login IAM -> vCD portal-> select VM-> NICs
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.higiocloud.vn/compute/4.-hi-gio-api/api-reconfigures-vms-networks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
