API power on/off VM
- Tran Dai Quan
- Tran Khanh Ngoc
Overview
In this manual, you will find detailed information on how to prepare information, get VM status, and change status VM.
Procedure
Step 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
Step 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
Step 3: Change status VM
POST https://{{vcd_url}}/api/vApp/{{vm_uuid}}/power/action/{{powerOn/powerOff}}
Authorization: {{Bearer Token}}
Headers:
- ‘Accept’: */*;version=37.2
SEND request.
Step 4: Verify
Get VM’s status information
GET https://{{vcd_url}}/api/vApp/{{vm-uuid}}
Check on vCD portal
Login IAM -> vCD portal-> select VM
End.