VM power actions using the API

To perform a power action (except for reset) on a VM using the API:

  1. Perform a GET request to obtain the VM object and find the VM state link

  2. Create a virtualmachinestate object

  3. Send a PUT request to the VM state link

The VM state link is a link in the VM object with the "rel" attribute set to state. The "title" attribute contains the current state. You can send a PUT request of a virtualmachine state object to the link (in the "href" attribute) to change the power state of the VM.

{ "title": "ON", "rel": "state", "type": "application/vnd.abiquo.virtualmachinestate+json", "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/state" },

 

Here are some examples of virtualmachinestate objects and notes about changing VM states

To reset a VM using the API, use a POST request to the reset action link. If you are using a test environment, you may wish to add the --insecure option.

cURL:

Success status code: 202

Request payload:

--none--

Response payload:

Copyright © 2006-2024, Abiquo Holdings SL. All rights reserved