# API reconfigures VM's Memory

## <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 the VM’s memory information, and reconfigure the VM’s memory.

## <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}}<br>

  <figure><img src="https://3953927389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbvay7AR0CH8vZKgD3dSy%2Fuploads%2FFPmXQpVyZnaGXuGcyghj%2Fimage.png?alt=media&#x26;token=53a8e940-ef99-4c8e-b402-d653c4ba895d" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://3953927389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbvay7AR0CH8vZKgD3dSy%2Fuploads%2FDLcc052D5HAPFPJHWnvi%2Fimage.png?alt=media&#x26;token=53c8cac1-f5a7-4b51-8d40-05602e1cd739" alt=""><figcaption></figcaption></figure>

-{{Bearer Token}}: Please follow **“Api token login”** document
{% endstep %}

{% step %}

#### **Step 2: Get VM’s memory information**

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

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

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

<figure><img src="https://3953927389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbvay7AR0CH8vZKgD3dSy%2Fuploads%2Fet8vHwYWMlH5z3ViTlqA%2Fimage.png?alt=media&#x26;token=d6c1cd55-ed53-43f2-afc7-9a49424a07d4" alt=""><figcaption></figcaption></figure>

* SEND request.

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

{% step %}
**Step 3: Reconfig VM’s memory**

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

-'Accept: */*;version=37.2

-‘Content-type’: application/vnd.vmware.vcloud.rasdItem+xml&#x20;

Body: {{select raw -> copy and paste response body from Get VM’s memory information }}&#x20;

Ex:

```

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns4:Item xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:common="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns4="http://www.vmware.com/vcloud/v1.5" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf"
………………………………………………………….
……………………………………………………………
    <rasd:ResourceType>4</rasd:ResourceType>
    <rasdraidtualQuantity>2048</rasd:VirtualQuantity>
    <rasd:VirtualQuantityUnits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
type="application/vnd.vmware.vcloud.rasdItem+json"/>
</ns4:Item>
```

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

Find line “<mark style="color:blue;">\<rasd:VirtualQuantity>2048\</rasd:VirtualQuantity></mark>” and edit the value, it’s the VM’s memory (MB).Please note that Value must be a multiple of 4 MB<br>

<figure><img src="https://3953927389-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fbvay7AR0CH8vZKgD3dSy%2Fuploads%2Fe1IKFOgEYhHjXVRuU51M%2Fimage.png?alt=media&#x26;token=4cbff568-2822-458e-a0bf-0236723875f5" alt=""><figcaption></figcaption></figure>

* SEND request.
  {% endstep %}

{% step %}

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

* **Get VM’s memory information**

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

* **Check on vCD portal**

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