...
Create a VM with the UI and the API
Get a VM and deploy it
Get a group of VMs with the API
...
Requirements
You will need to be familiar with your browser tools. We used Google Chrome.
...
Log in to Abiquo and open your browser console to the Network tab
Record browser actions
Create a VM in the UI. The UI will send a
POST
request to the APIIn the browser console, find the POST request
Tips when using Chrome:
To display the Method column to easily identify the
POST
request, right-click on the header row to display the header options list, then select Method.To copy the request directly from the UI, right-click on the request URL and select Copy as cURL and delete UI cache details from the URL before you run it
From Headers, Response Headers find the location. This is the VM link where you will send requests to modify the VM
From the Payload, click view source, and right-click and copy, then format with a JSON formatter. This is the VM object that you can modify and use in the next request to create a VM
Screenshot from Chrome: the POST request to create a VM is selected.
...
Analyze the post request
...
To manage the VM, you will send requests to VM links, so you should now save some links from the VM object. It is also useful to know the ID of the VM in the API.
From the VM object,:
Get the link with a
rel
key that has a value ofedit
. Also note that in the example the VM has anid
of305
.Code Block ... { "links":[ ... { "title": "vmapihowto2", "rel": "edit", "type": "application/vnd.abiquo.virtualmachine+json", "href": "https://mjsabiquo.lab.abiquo.com:443/api/cloud/virtualdatacenters/12/virtualappliances/4/virtualmachines/305" }, ...
Also get the link with a
rel
key that has a value ofdeploy
.Code Block ... { "title": "virtual machine deploy", "rel": "deploy", "type": "application/vnd.abiquo.acceptedrequest+json", "href": "https://mjsabiquo.lab.abiquo.com:443/api/cloud/virtualdatacenters/12/virtualappliances/4/virtualmachines/305/action/deploy" }, ...
...