Abiquo 5.0

Skip to end of metadata
Go to start of metadata

Introduction

This tutorial describes how to create and deploy a basic VM with the Abiquo cloud platform. It also describes how to retrieve a single entity and a group of entities from the cloud platform.

This document introduces the API from the perspective of the Abiquo user interface (UI). 

  • All Abiquo platform functionality as seen in the UI is also available through the Abiquo REST API
  • The UI runs as a client of the API, using the API to perform actions on the platform
  • Abiquo recommends that before you start working with the API, you should use the Abiquo UI to learn about the features and functionality of the platform. Or at least do the Abiquo Quick Tutorial.

You can apply the basic general flow from this document to other Abiquo entities.

  • Replace the URLs in the examples with the URL for your own environment
  • We provide example responses in case you are reading this without access to the platform
  • Due to release timing, some of the requests examples may be run using different versions and media types may vary slightly


Prerequisites

To follow along with this tutorial, we recommend that you use a Firefox or Chrome browser. The screenshots and instructions here are from Chrome.

You will need a working Abiquo platform with:

  • Cloud infrastructure including a datacenter, rack, and hypervisor host
  • A virtual datacenter with a virtual appliance inside
  • An Abiquo private network in the virtual datacenter with two IP addresses added to it. 




Authentication

You will need to authenticate with your own credentials as appropriate in your environment. For a complete guide, see Authentication. For this tutorial you could use:

  • Token authentication: you could use the token returned in the X-Abiquo-Token header in the format "Authentication: Token XXXXXXXX", replacing XXXXXXXX with the token. 
    • To obtain this token, you can send a GET request to the login resource of your API, for example, https://abiquo.example.com/api/login 
  • Basic authentication: in a securely isolated test environment, you could use your user and password, in the format "-u user:password". 
    • To use basic authentication, you can add the insecure "-k" option to the request. 
  • OAuth authentication. See Authentication




Create an entity with the UI and obtain the entity data object

First, create a VM with the UI.

  1. Open your connection to Abiquo and open your browser console to the Network tab
  2. Check that the browser is recording actions, e.g. click the red record button
  3. Create a VM in the UI, which will issue a POST request to the API
  4. In the browser console, find the POST request

Screenshot from Chrome: the post request to create a VM is highlighted in blue

In 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 create a VM, the Abiquo UI makes the POST request to the virtualmachines link of the virtual appliance. This link contains the IDs of the virtual datacenter and virtual appliance.

https://nardo40.bcn.abiquo.com/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines

In this case, the ID values are 2486 and 2990.

To copy a request directly from the UI, right-click on the request URL and select Copy as cURL. Note that you may have to delete UI cache details before you run the cURL.

In your browser console, select the POST request that created the VM and go to the Headers tab.

The following screenshot highlights the the API Location (in the Response headers) and Request Payload of a VM.

The Request Payload is the VM object that the UI sent to create the VM. It is very simple with just a friendly name label (which by default is the VM template name), a template link, plus the default option to enable remote access to the VM. This is one of the simplest data objects that you can use to create a VM.

Click "view source", and copy the request payload. If you format it with a JSON formatter, it should look similar to the following example.

{
   "label":"yVM_Abiquo_enterprise",
   "links":[
      {
         "title":"yVM_Abiquo_enterprise",
         "rel":"virtualmachinetemplate",
         "type":"application/vnd.abiquo.virtualmachinetemplate+json",
         "href":"https://nardo40.bcn.abiquo.com:443/api/admin/enterprises/336/datacenterrepositories/1/virtualmachinetemplates/2"
      }
   ],
   "vdrpEnabled":true
} 


The Location link shows the VM location in the API, which is the URL of the VM, as shown here.

https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19453 

The last element of the URL is the ID of the VM, which has a value of 19453. We can use the above link to retrieve this VM.

To retrieve all the VMs in the virtual appliance, you can use the link to virtualmachines, without referring to any specific VM.

 https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/

These URLs are the API locations of the VMs.



Create an entity using the API

We are now going to create a new VM with a different friendly-name label.

To create the new VM, use the link to virtualmachines from the previous step, and send a POST request with the modified data entity.  For example, we could change "yvm_Abiquo_enterprise" to "yVM_New".

Here we have an example of an API request to create a VM:

curl --verbose -X POST 'https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines' \
 -H 'Content-Type: application/vnd.abiquo.virtualmachine+json;version=5.0' \
 -H 'Accept: application/vnd.abiquo.virtualmachine+json;version=5.0'  \
 -u user:password \
 -d '{"label":"yVM_New","links":[{"title":"yVM_Abiquo_enterprise","rel":"virtualmachinetemplate","type":"application/vnd.abiquo.virtualmachinetemplate+json","href":"https://nardo40.bcn.abiquo.com:443/api/admin/enterprises/336/datacenterrepositories/1/virtualmachinetemplates/2"}],"vdrpEnabled":true}'  

We are working with JSON objects and we specify them with request content headers that start with "-H". The Content-Type header refers to the VM object we are sending. And the Accept header refers to the API response we will receive.

You can also use XML instead of JSON with the Abiquo API and to do this, you would use "+xml" instead of "+json" in all the headers. Abiquo recommends JSON format. There may be some slight differences between the formats, so always retrieve an object in the format you are working with and modify it to ensure the correct data structure.

We specify the virtualmachine media type and the version number.

To control compatibility always specify the version number in your requests because if you do not specify a version, the API will always return the latest one, meaning that after an upgrade to the platform your code may cease to work as intended.

If the API creates the machine successfully, the response body contains the VM object.

From the VM object, note the link with a "rel" value of "edit". Also note that in the example the VM has an "id" of 19454.

...
{  
   "links":[
      {
         "title":"ABQ_2fb11009-8157-4d61-915d-40fa45f440ac",
         "rel":"edit",
         "type":"application/vnd.abiquo.virtualmachine+json",
         "href":"https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454"
      },
...

Also note the deploy link.

...
      {
         "title":"virtual machine deploy",
         "rel":"deploy",
         "type":"application/vnd.abiquo.acceptedrequest+json",
         "href":"https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/deploy"
      },
...




Display the VM in the UI

When you've created the VM, return to the UI and you should be able to find the new VM!  




Retrieve an entity using the API

To retrieve the details of the VM you just created, perform a GET request to the edit link of the VM.

curl --verbose 'https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454' \
	-H 'Accept: application/vnd.abiquo.virtualmachine+json; version=5.0' \
	-u user:password -k

The result of this query is a VM data object in JSON format. The expanding section below contains the full request. On a Linux system, to format the response JSON body inline, you could try piping it to jq (with "| jq ."))

 Click here to expand...
user@user:~ $ curl --verbose 'https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454' \
-H 'Accept: application/vnd.abiquo.virtualmachine+json; version=5.0' \
-u cloudadmin:cloudadmin -k | jq .

* Connected to nardo40.bcn.abiquo.com (10.60.11.9) port 443 (#0)
* Server auth using Basic with user 'user'
> GET /api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454 HTTP/1.1
> Host: nardo40.bcn.abiquo.com
> Authorization: Basic XYZABC123456XYZABC123456
> User-Agent: curl/7.64.1
> Accept: application/vnd.abiquo.virtualmachine+json; version=5.0
> 
< HTTP/1.1 200 200
< Date: Wed, 29 Jul 2020 13:50:01 GMT
< Server: Apache
< Set-Cookie: ABQSESSIONID=3886214693190666792; Max-Age=1800; Expires=Wed, 29-Jul-2020 14:20:02 GMT; Path=/; Secure; HttpOnly; SameSite=strict
< X-Abiquo-TracerContext: cf28dd0d-edd2-4279-9405-e8f019ad6674
< X-Abiquo-Token: a2e19816735381c1d074441cbd002aa0eaab83316e8f1afc29b10852ee681c31b86928f2e3fbe462f05221a4ed1d881e63008dc39913aa3a0aa774576f863bdf
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< Strict-Transport-Security: max-age=31536000 ; includeSubDomains
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: DENY
< X-Content-Type-Options: nosniff
< Content-Type: application/vnd.abiquo.virtualmachine+json; version=5.0
< Transfer-Encoding: chunked
< 

{
  "id": 19454,
  "uuid": "2fb11009-8157-4d61-915d-40fa45f440ac",
  "fqdn": "box.localdomain",
  "description": "A virtual machine",
  "coresPerSocket": 1,
  "idState": 4,
  "idType": 0,
  "type": "MANAGED",
  "highDisponibility": 0,
  "monitored": false,
  "monitoringLevel": "DEFAULT",
  "protected": false,
  "variables": {},
  "backuppolicies": [],
  "lastSynchronize": 1596030155000,
  "generateGuestInitialPassword": false,
  "natrules": [],
  "internalProviderId": "vm-58650-at-10.60.11.242",
  "vdrpEnabled": true,
  "vdrpPort": 443,
  "vdrpIP": "10.60.2.29",
  "password": "ybu1f6iT",
  "deallocated": false,
  "name": "ABQ_2fb11009-8157-4d61-915d-40fa45f440ac",
  "label": "yVM_New",
  "ram": 48,
  "cpu": 1,
  "state": "ON",
  "creationTimestamp": 1596029202000,
  "links": [
    {
      "title": "VCENTER_CLUSTER",
      "rel": "machine",
      "type": "application/vnd.abiquo.machine+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/admin/datacenters/1/racks/25/machines/440"
    },
    {
      "title": "Abiquo-DC",
      "rel": "location",
      "type": "application/vnd.abiquo.datacenter+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/locations/1"
    },
    {
      "title": "5.1.0_Snapshot Enterprise testing",
      "rel": "enterprise",
      "type": "application/vnd.abiquo.enterprise+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/admin/enterprises/336"
    },
    {
      "title": "ABQ_2fb11009-8157-4d61-915d-40fa45f440ac",
      "rel": "edit",
      "type": "application/vnd.abiquo.virtualmachine+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454"
    },
    {
      "rel": "asynctasks",
      "type": "application/vnd.abiquo.asynctasks+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/asynctasks"
    },
    {
      "title": "send mail",
      "rel": "sendmail",
      "type": "application/vnd.abiquo.mail+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/admin/datacenters/1/racks/25/machines/440/virtualmachines/19454/action/sendmail"
    },
    {
      "title": "cloudadmin cloudadmin",
      "rel": "user",
      "type": "application/vnd.abiquo.user+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/admin/enterprises/336/users/10"
    },
    {
      "title": "vdc_api_tutorial",
      "rel": "virtualdatacenter",
      "type": "application/vnd.abiquo.virtualdatacenter+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486"
    },
    {
      "title": "vap_api_tutorial",
      "rel": "virtualappliance",
      "type": "application/vnd.abiquo.virtualappliance+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990"
    },
    {
      "title": "metadata",
      "rel": "metadata",
      "type": "application/vnd.abiquo.metadata+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/metadata"
    },
    {
      "title": "vlan network configurations",
      "rel": "configurations",
      "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/network/configurations"
    },
    {
      "title": "192.168.0.0/24",
      "rel": "network_configuration",
      "type": "application/vnd.abiquo.virtualmachinenetworkconfiguration+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/network/configurations/3490"
    },
    {
      "title": "nics",
      "rel": "nics",
      "type": "application/vnd.abiquo.nics+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/network/nics"
    },
    {
      "title": "disks",
      "rel": "harddisks",
      "type": "application/vnd.abiquo.harddisks+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/storage/disks"
    },
    {
      "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"
    },
    {
      "title": "virtual machine undeploy",
      "rel": "undeploy",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/undeploy"
    },
    {
      "title": "virtual machine deploy",
      "rel": "deploy",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/deploy"
    },
    {
      "title": "virtual machine reset",
      "rel": "reset",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/reset"
    },
    {
      "title": "virtual machine snapshot",
      "rel": "instance",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/instance"
    },
    {
      "title": "remote access",
      "rel": "rdpaccess",
      "type": "application/vnd.abiquo.virtualmachineconsole+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/config/rdpaccess"
    },
    {
      "title": "tasks",
      "rel": "tasks",
      "type": "application/vnd.abiquo.tasks+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/tasks"
    },
    {
      "title": "firewalls",
      "rel": "firewalls",
      "type": "application/vnd.abiquo.links+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/firewalls"
    },
    {
      "title": "load balancers",
      "rel": "loadbalancers",
      "type": "application/vnd.abiquo.loadbalancers+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/loadbalancers"
    },
    {
      "title": "request on demand backup",
      "rel": "requestbackup",
      "type": "application/vnd.abiquo.ondemandbackup+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/backup/action/request"
    },
    {
      "title": "request a restore of a backup",
      "rel": "requestrestore",
      "type": "application/vnd.abiquo.restore+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/backup/action/restore"
    },
    {
      "title": "move VM to a virtual appliance",
      "rel": "vappmove",
      "type": "application/vnd.abiquo.links+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/vappmove"
    },
    {
      "title": "move VM to another virtual datacenter",
      "rel": "move",
      "type": "application/vnd.abiquo.movevm+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/move"
    },
    {
      "title": "volumes",
      "rel": "volumes",
      "type": "application/vnd.abiquo.volumes+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/storage/volumes"
    },
    {
      "diskAllocation": "THIN",
      "diskControllerType": "IDE",
      "diskLabel": "Hard disk 1",
      "length": "64",
      "title": "4ffdcc26-6b30-47db-99b7-20bccbe285ea",
      "rel": "disk0",
      "type": "application/vnd.abiquo.harddisk+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/disks/18018"
    },
    {
      "title": "datastoretierESXI6.0_2.29",
      "rel": "datastoretier0",
      "type": "application/vnd.abiquo.datastoretier+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/locations/1/datastoretiers/58"
    },
    {
      "title": "192.168.0.2",
      "rel": "nic0",
      "type": "application/vnd.abiquo.privateip+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/privatenetworks/3490/ips/18020"
    },
    {
      "title": "protect",
      "rel": "protect",
      "type": "text/plain",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/protect"
    },
    {
      "title": "unprotect",
      "rel": "unprotect",
      "type": "text/plain",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/unprotect"
    },
    {
      "title": "metricsmetadata",
      "rel": "metricsmetadata",
      "type": "application/vnd.abiquo.metricsmetadata+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/metrics"
    },
    {
      "title": "enablemonitoring",
      "rel": "enablemonitoring",
      "type": "",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/enablemonitoring"
    },
    {
      "title": "collectd",
      "rel": "collectd",
      "type": "application/json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/metrics/collectd"
    },
    {
      "title": "alarmssearch",
      "rel": "alarmssearch",
      "type": "application/vnd.abiquo.alarms+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/alarms"
    },
    {
      "title": "clone",
      "rel": "clone",
      "type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/clone"
    },
    {
      "title": "VMware vCenter Cluster",
      "rel": "hypervisortype",
      "type": "application/vnd.abiquo.hypervisortype+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/config/hypervisortypes/VCENTER_CLUSTER"
    },
    {
      "title": "yVM_Abiquo_enterprise",
      "rel": "virtualmachinetemplate",
      "type": "application/vnd.abiquo.virtualmachinetemplate+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/admin/enterprises/336/datacenterrepositories/1/virtualmachinetemplates/2"
    },
    {
      "title": "Others",
      "rel": "category",
      "type": "application/vnd.abiquo.category+json",
      "href": "https://nardo40.bcn.abiquo.com:443/api/config/categories/1"
    }
  ],
  "usageStatistics": []
}




Retrieve a group of entities with the API

To retrieve the collection of VMs in the virtual appliance, send a GET request to the virtualmachines link.

https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines

The response contains metadata about the size of the collection and the default paging links. The following example shows the collection information but we removed the VM links to reduce the size of the example.

 Click here to expand...
 {
  "totalSize": 2,
  "links": [
    {
      "rel": "first",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines?limit=25&by=name&asc=true"
    },
    {
      "rel": "last",
      "href": "https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines?startwith=0&limit=25&by=name&asc=true"
    }
  ],
  "collection": [
    {
      "id": 19454,
      "uuid": "2fb11009-8157-4d61-915d-40fa45f440ac",
      "fqdn": "box.localdomain",
      "description": "A virtual machine",
      "coresPerSocket": 1,
      "idState": 1,
      "idType": 0,
      "type": "MANAGED",
      "highDisponibility": 0,
      "monitored": false,
      "monitoringLevel": "DEFAULT",
      "protected": false,
      "variables": {},
      "backuppolicies": [],
      "lastSynchronize": 1596030155000,
      "generateGuestInitialPassword": false,
      "natrules": [],
      "vdrpEnabled": true,
      "vdrpPort": 0,
      "password": "ybu1f6iT",
      "deallocated": false,
      "name": "ABQ_2fb11009-8157-4d61-915d-40fa45f440ac",
      "label": "yVM_New",
      "ram": 48,
      "cpu": 1,
      "state": "NOT_ALLOCATED",
      "creationTimestamp": 1596029202000,
      "links": [
      ...
      ],
      "usageStatistics": []
    },
    {
      "id": 19453,
      "uuid": "e73648be-81bc-49ba-b78f-041072bc74c8",
      "description": "A virtual machine",
      "coresPerSocket": 1,
      "idState": 1,
      "idType": 0,
      "type": "MANAGED",
      "highDisponibility": 0,
      "monitored": false,
      "protected": false,
      "variables": {},
      "backuppolicies": [],
      "generateGuestInitialPassword": false,
      "natrules": [],
      "vdrpEnabled": true,
      "vdrpPort": 0,
      "password": "lQzO28DT",
      "deallocated": false,
      "name": "ABQ_e73648be-81bc-49ba-b78f-041072bc74c8",
      "label": "yVM_Abiquo_enterprise",
      "ram": 48,
      "cpu": 1,
      "state": "NOT_ALLOCATED",
      "creationTimestamp": 1596028468000,
      "links": [
      ...
      ],
      "usageStatistics": []
    }
  ],
  "duplicatedvms": []
}




Deploy your VM

To deploy the VM you created, send a POST request to the deploy link of the VM.

curl --verbose -X POST 'https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/action/deploy' \
-u user:password -k

The API will respond with an accepted request object and a link that you can use to check the progress of the deploy.

{   "message":"You can keep track of the progress in the link",
   "links":[      {
         "title":"status",
         "rel":"status",
         "type":"application/vnd.abiquo.task+json",
         "href":"https://nardo40.bcn.abiquo.com:443/api/cloud/virtualdatacenters/2486/virtualappliances/2990/virtualmachines/19454/tasks/a975de9c-8558-4487-8f43-153df2d3cb55"

      }

   ]
}

Of course, you can also switch back to the UI and watch the VM deploy!




Conclusion

Congratulations, you have created a VM and deployed a VM with the API. And you also know how to retrieve an entity and a collection of entities, and you can apply this method to any entity, using the entity link and a GET request.

To work through how to modify and delete entities, see Get Started with the Abiquo API part 2.


Related links