Api power on/off VM

API power on/off VM

* Main steps

- Preparation

- Get VM status

- Change status VM

1. Prepare information

* Login IAM portal -> vCD portal: collect the information

- {{vcd_url}}

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

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

2. Get VM status

GET https://{{vcd_url}}/api/vApp/{{vm_uuid}}

Authorization: {{Bearer Token }}

Headers:

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

SEND request.

Check the VM status on line 3 of Response Body. If Link rel="power:powerOff", VM is Power ON else VM is Power Off

3. Change status VM

Postman:

POST https://{{vcd_url}}/api/vApp/{{vm_uuid}}/power/action/{{powerOn/powerOff}}

Authorization: {{Bearer Token}}

Headers:

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

SEND request.

3. Verify

* Get VM’s status information

GET https://{{vcd_url}}/api/vApp/{{vm-uuid}}

* Check on vCD portal

Login IAM -> vCD portal-> select VM