Abiquo 5.2

Skip to end of metadata
Go to start of metadata




Introduction

Welcome to the REST API of the Abiquo cloud platform. Yes, the Abiquo API really is a HATEOAS REST API. 

So there are links everywhere, for navigation, to perform actions, and even to define the configuration of cloud entities.

Fortunately, the Abiquo UI is a client of the Abiquo public REST API, so it's easy to look in your browser tools and find out how the UI performs any API request. 

In this tutorial you will:

  1. Create a VM with the UI and the API
  2. Get a VM and deploy it
  3. Get a group of VMs with the API




Requirements

You will need to be familiar with your browser tools. We used Google Chrome.

To complete this tutorial and part 2, you will need a working Abiquo platform with: 

  1. private cloud infrastructure 
  2. a virtual datacenter with a virtual appliance inside
  3. an Abiquo private network in the virtual datacenter with two IP addresses in it

To become familiar with the UI and create the required entities:



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: 
    1. Send a GET request with basic authentication to the login resource of your API, for example, https://abiquo.example.com/api/login
    2. Get the token from the X-Abiquo-Token header 
    3. In your request, use the format "Authentication: Token XXXXXXXX" 
  • Basic authentication: in a securely isolated test environment only
    • Use "Authentication: Basic XXXXX" with the password in base64 encoding
      Or in the request line use the format "-u user:password". 
    • In your test environment you may also need to add the insecure "-k" option to the request. 
  • OAuth authentication. See Authentication




Create a VM with the UI and obtain the POST request

Create a VM with the UI to obtain the API method link and data object.

  1. Log in to Abiquo and open your browser console to the Network tab
  2. Record browser actions
  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

Chrome tips

  • 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". (Delete UI cache details from the URL before you run the cURL!)

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




Analyse the POST request

To create a VM, the Abiquo UI makes the POST request to the virtualmachines link of the virtual appliance entity, sending a basic VM object.

 Click to show/hide how to view the POST request in the browser

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, which are important parts of the request.

To copy the Request payload, click "view source", and copy, then format with a JSON formatter.


  • The UI sent the POST request to the virtualmachines link. It contains the IDs of the virtual datacenter and virtual appliance.

    https://linatest.bcn.abiquo.com/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines

    In this case, the ID values are 42 and 110.

  • The Request Payload contains the basic VM object with a label (friendly name) and a link to a VM template, and an option to enable remote access to the VM.

    {
       "label":"yVM_mj",
       "links":[
          {
             "title":"yVM_mj",
             "rel":"virtualmachinetemplate",
             "type":"application/vnd.abiquo.virtualmachinetemplate+json",
             "href":"https://linatest.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/7/virtualmachinetemplates/520"
          }
       ],
       "vdrpEnabled":true
    }  
  • After the POST request is successful, the Location link, which you can obtain from the Request headers is the URL of the VM in the API.

    https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1918


    The last element of the URL is the ID of the VM, which has a value of 1918.





Create a VM using the API

To create a new VM:

  1. Create a POST request to the virtualmachines link
  2. Add appropriate headers to describe your JSON data objects. The Content-Type header refers to the VM object we are sending. And the Accept header refers to the API response we will receive.

    Specify the media type and version number otherwise you may be surprised!

  3. Use authentication (see the Authentication section above)
  4. As request data, add the VM entity from the previous step and change the label attribute, e.g. change  "yVM_mj" to "yVM_mj_2".   

For example:

curl -X POST 'https://linatest.bcn.abiquo.com/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines' \
  -H 'Accept: application/vnd.abiquo.virtualmachine+json;version=5.2' \
  -H 'Authorization: Token XXXXXXXX' \
  -H 'Content-Type: application/vnd.abiquo.virtualmachine+json;version=5.2' \
  --data-raw '{"label":"yVM_mj_2","links":[{"title":"yVM_mj","rel":"virtualmachinetemplate","type":"application/vnd.abiquo.virtualmachinetemplate+json","href":"https://linatest.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/7/virtualmachinetemplates/520"}],"vdrpEnabled":true}' \
  --insecure --verbose | jq .

In this case we will use "jq" to format the response.

Send your POST request. If the API creates the machine successfully, the response body contains the VM object.




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

...
{  
   "links":[
    {
      "title": "ABQ_6b2d0d93-7f23-4a78-af5f-a9398be58773",
      "rel": "edit",
      "type": "application/vnd.abiquo.virtualmachine+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920"
    },
...

Also get the deploy link.

...
    {
      "title": "virtual machine deploy",
      "rel": "deploy",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/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!  




Get the new VM 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://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920' \
	-H 'Accept: application/vnd.abiquo.virtualmachine+json; version=5.2' \
	-u user:password -k | jq .

The result of this query is a VM data object in JSON format. 

 Click here to show/hide the full request
 √ Abiquo % curl --verbose 'https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920' \
        -H 'Accept: application/vnd.abiquo.virtualmachine+json; version=5.2' \
        -u user:password -k | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 10.60.11.17...

> GET /api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920 HTTP/1.1
> Host: linatest.bcn.abiquo.com
> Authorization: Basic XXXXXX
> User-Agent: curl/7.64.1
> Accept: application/vnd.abiquo.virtualmachine+json; version=5.2
> 
< HTTP/1.1 200 200
< Date: Fri, 16 Apr 2021 16:02:28 GMT
< Server: Apache
< Set-Cookie: ABQSESSIONID=3829114884430768718; Max-Age=1800; Expires=Fri, 16-Apr-2021 16:32:28 GMT; Path=/; Secure; HttpOnly; SameSite=strict
< X-Abiquo-TracerContext: bb4dcd39-1eb8-4ea4-af7d-ad7cc59dddd6
< X-Abiquo-Token: a2e19816735381c1d074441cbd002aa060eb5ad16d8e348826ee0bbf2d168d0c7c48802f6f437b27e6729eb5403143e534f304214ceebf0e8de993f110ff8d5b
< 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.2
< Transfer-Encoding: chunked
< 

{
  "id": 1920,
  "uuid": "6b2d0d93-7f23-4a78-af5f-a9398be58773",
  "description": "A virtual machine",
  "coresPerSocket": 1,
  "idState": 1,
  "idType": 0,
  "type": "MANAGED",
  "highDisponibility": 0,
  "monitored": true,
  "protected": false,
  "variables": {},
  "backuppolicies": [],
  "generateGuestInitialPassword": false,
  "natrules": [],
  "vdrpEnabled": true,
  "vdrpPort": 0,
  "password": "xPUOwNxb",
  "deallocated": false,
  "name": "ABQ_6b2d0d93-7f23-4a78-af5f-a9398be58773",
  "label": "yVM_mj_2",
  "ram": 48,
  "cpu": 1,
  "state": "NOT_ALLOCATED",
  "creationTimestamp": 1618588107000,
  "links": [
    {
      "title": "Abiquo",
      "rel": "enterprise",
      "type": "application/vnd.abiquo.enterprise+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/admin/enterprises/1"
    },
    {
      "title": "ABQ_6b2d0d93-7f23-4a78-af5f-a9398be58773",
      "rel": "edit",
      "type": "application/vnd.abiquo.virtualmachine+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920"
    },
    {
      "rel": "asynctasks",
      "type": "application/vnd.abiquo.asynctasks+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/asynctasks"
    },
    {
      "title": "send mail",
      "rel": "sendmail",
      "type": "application/vnd.abiquo.mail+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/admin/publiccloudregions/7/enterprises/1/virtualmachines/1920/action/sendmail"
    },
    {
      "title": "cloudadmin",
      "rel": "user",
      "type": "application/vnd.abiquo.user+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/admin/enterprises/1/users/10"
    },
    {
      "title": "vdc_ESXI_vCenter",
      "rel": "virtualdatacenter",
      "type": "application/vnd.abiquo.virtualdatacenter+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42"
    },
    {
      "title": "vapp_web",
      "rel": "virtualappliance",
      "type": "application/vnd.abiquo.virtualappliance+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110"
    },
    {
      "title": "metadata",
      "rel": "metadata",
      "type": "application/vnd.abiquo.metadata+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/metadata"
    },
    {
      "title": "vlan network configurations",
      "rel": "configurations",
      "type": "application/vnd.abiquo.virtualmachinenetworkconfigurations+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/network/configurations"
    },
    {
      "title": "nics",
      "rel": "nics",
      "type": "application/vnd.abiquo.nics+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/network/nics"
    },
    {
      "title": "disks",
      "rel": "harddisks",
      "type": "application/vnd.abiquo.harddisks+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/storage/disks"
    },
    {
      "title": "NOT_ALLOCATED",
      "rel": "state",
      "type": "application/vnd.abiquo.virtualmachinestate+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/state"
    },
    {
      "title": "virtual machine undeploy",
      "rel": "undeploy",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/action/undeploy"
    },
    {
      "title": "virtual machine deploy",
      "rel": "deploy",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/action/deploy"
    },
    {
      "title": "virtual machine reset",
      "rel": "reset",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/action/reset"
    },
    {
      "title": "virtual machine snapshot",
      "rel": "instance",
      "type": "application/vnd.abiquo.acceptedrequest+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/action/instance"
    },
    {
      "title": "remote access",
      "rel": "rdpaccess",
      "type": "application/vnd.abiquo.virtualmachineconsole+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/config/rdpaccess"
    },
    {
      "title": "tasks",
      "rel": "tasks",
      "type": "application/vnd.abiquo.tasks+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/tasks"
    },
    {
      "title": "firewalls",
      "rel": "firewalls",
      "type": "application/vnd.abiquo.links+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/firewalls"
    },
    {
      "title": "load balancers",
      "rel": "loadbalancers",
      "type": "application/vnd.abiquo.loadbalancers+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/loadbalancers"
    },
    {
      "title": "request on demand backup",
      "rel": "requestbackup",
      "type": "application/vnd.abiquo.ondemandbackup+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/backup/action/request"
    },
    {
      "title": "request a restore of a backup",
      "rel": "requestrestore",
      "type": "application/vnd.abiquo.restore+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/backup/action/restore"
    },
    {
      "title": "move VM to a virtual appliance",
      "rel": "vappmove",
      "type": "application/vnd.abiquo.links+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/action/vappmove"
    },
    {
      "title": "move VM to another virtual datacenter",
      "rel": "move",
      "type": "application/vnd.abiquo.movevm+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/action/move"
    },
    {
      "title": "volumes",
      "rel": "volumes",
      "type": "application/vnd.abiquo.volumes+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/storage/volumes"
    },
    {
      "diskControllerType": "IDE",
      "diskLabel": "Hard disk 1",
      "length": "64",
      "title": "4166504b-d350-439e-adcb-1bc2b57814e0",
      "rel": "disk0",
      "type": "application/vnd.abiquo.harddisk+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/disks/1896"
    },
    {
      "title": "Default Tier",
      "rel": "datastoretier0",
      "type": "application/vnd.abiquo.datastoretier+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/locations/7/datastoretiers/8"
    },
    {
      "title": "protect",
      "rel": "protect",
      "type": "text/plain",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/action/protect"
    },
    {
      "title": "unprotect",
      "rel": "unprotect",
      "type": "text/plain",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/action/unprotect"
    },
    {
      "title": "metricsmetadata",
      "rel": "metricsmetadata",
      "type": "application/vnd.abiquo.metricsmetadata+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/metrics"
    },
    {
      "title": "disablemonitoring",
      "rel": "disablemonitoring",
      "type": "",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/disablemonitoring"
    },
    {
      "title": "collectd",
      "rel": "collectd",
      "type": "application/json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/metrics/collectd"
    },
    {
      "title": "alarmssearch",
      "rel": "alarmssearch",
      "type": "application/vnd.abiquo.alarms+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/alarms"
    },
    {
      "title": "clone",
      "rel": "clone",
      "type": "application/vnd.abiquo.virtualmachinecloneoptions+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/action/clone"
    },
    {
      "rel": "tags",
      "type": "application/vnd.abiquo.resourcetags+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/tags"
    },
    {
      "rel": "tags-update",
      "type": "application/vnd.abiquo.tags+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/tags"
    },
    {
      "rel": "tags-format",
      "type": "application/vnd.abiquo.tagformatrestrictions+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/tags"
    },
    {
      "rel": "tags-create",
      "type": "application/vnd.abiquo.tags+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/tags/action/create"
    },
    {
      "rel": "tags-delete",
      "type": "application/vnd.abiquo.tagkeys+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/tags/action/delete"
    },
    {
      "rel": "tags-edit",
      "type": "application/vnd.abiquo.tags+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/tags/action/edit"
    },
    {
      "rel": "tags-sync",
      "type": "",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/tags/action/sync"
    },
    {
      "title": "VMware vCenter",
      "rel": "hypervisortype",
      "type": "application/vnd.abiquo.hypervisortype+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/config/hypervisortypes/VMX_04"
    },
    {
      "title": "yVM_mj",
      "rel": "virtualmachinetemplate",
      "type": "application/vnd.abiquo.virtualmachinetemplate+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/admin/enterprises/1/datacenterrepositories/7/virtualmachinetemplates/520"
    },
    {
      "title": "Others",
      "rel": "category",
      "type": "application/vnd.abiquo.category+json",
      "href": "https://linatest.bcn.abiquo.com:443/api/config/categories/1"
    }
  ],
  "usageStatistics": []
}




Get a group of VMs with the API

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

https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines

The response contains metadata about the size of the collection and the default paging links. (We removed the VM links to reduce the size of the example).

 Click here to show/hide the virtualmachines collection example
  {
  "totalSize": 2,
  "links": [
    {
      "rel": "first",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines?limit=25&by=name&asc=true"
    },
    {
      "rel": "last",
      "href": "https://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines?startwith=0&limit=25&by=name&asc=true"
    }
  ],
  "collection": [
    {
      "id": 1918,
      "uuid": "039b03e9-1639-4c46-a915-b53af7ea3445",
      "description": "A virtual machine",
      "coresPerSocket": 1,
      "idState": 1,
      "idType": 0,
      "type": "MANAGED",
      "highDisponibility": 0,
      "metadata": {
        "monitoring-metrics": [
          {
            "name": "Disk-latency"
          },
          {
            "name": "Memory-host"
          },
          {
            "name": "abq-ram_usage"
          },
          {
            "name": "Memory-swap2"
          },
          {
            "name": "Memory-physical"
          },
          {
            "name": "Memory-vmmemctl"
          },
          {
            "name": "CPU-time"
          },
          {
            "name": "Memory-swap"
          },
          {
            "name": "abq-cpu_usage"
          },
          {
            "name": "CPU-Mz"
          },
          {
            "name": "Memory"
          },
          {
            "name": "CPU"
          },
          {
            "name": "Uptime"
          }
        ]
      },
      "monitored": true,
      "protected": false,
      "variables": {},
      "backuppolicies": [],
      "generateGuestInitialPassword": false,
      "natrules": [],
      "vdrpEnabled": true,
      "vdrpPort": 0,
      "password": "E1Vmy4jx",
      "deallocated": false,
      "name": "ABQ_039b03e9-1639-4c46-a915-b53af7ea3445",
      "label": "yVM_mj",
      "ram": 48,
      "cpu": 1,
      "state": "NOT_ALLOCATED",
      "creationTimestamp": 1618586085000,
      "links": [
      ...
      ],
      "usageStatistics": []
    },
    {
      "id": 1920,
      "uuid": "6b2d0d93-7f23-4a78-af5f-a9398be58773",
      "description": "A virtual machine",
      "coresPerSocket": 1,
      "idState": 1,
      "idType": 0,
      "type": "MANAGED",
      "highDisponibility": 0,
      "monitored": true,
      "protected": false,
      "variables": {},
      "backuppolicies": [],
      "generateGuestInitialPassword": false,
      "natrules": [],
      "vdrpEnabled": true,
      "vdrpPort": 0,
      "password": "xPUOwNxb",
      "deallocated": false,
      "name": "ABQ_6b2d0d93-7f23-4a78-af5f-a9398be58773",
      "label": "yVM_mj_2",
      "ram": 48,
      "cpu": 1,
      "state": "NOT_ALLOCATED",
      "creationTimestamp": 1618588107000,
      "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://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/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://linatest.bcn.abiquo.com:443/api/cloud/virtualdatacenters/42/virtualappliances/110/virtualmachines/1920/tasks/140e0136-0ca2-4251-bee8-9656a23ea70f"
    }
  ]
}

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