Skip to end of metadata
Go to start of metadata


 This document describes how to upload and replace existing template disks using the Appliance manager API.

No URL and path validation

The request used in this section does NOT check that the disk URL refers to the currentPath.

Check that you are posting to the correct URL and that you have entered the correct values before running this request.

Use Case

  • Upload or download a template
  • Use it to create a virtual machine 
  • Update the template. Abiquo supports changes to:
    • file content
    • size
    • format
    • capacity
  • Update the disk using the Appliance manager API 
  • When the user next deploys the virtual machine, the platform will copy the updated disk


  1. Get the template details from the Abiquo API
  2. Create the replacement data object
  3. Replace the file using the Appliance manager API



1. Get the template details

First get the enterprise, for example, by using the has parameter to search for a text string in the enterprise names.

 Click here to show or hide the generic request example

If you are not already working with this enterprise, switch enterprise. 

 Click here to show or hide the generic request example

Get the link to the enterprise's datacenter repository for the appropriate datacenter. The link to the datacenter repositories can be found in the Enterprise entity.

          "href": "http://localhost:9009/api/admin/enterprises/506/datacenterrepositories", 
          "type": "application/vnd.abiquo.datacenterrepositories+json", 
          "rel": "datacenterrepositories", 
          "title": "repositories"

From this link you can get the datacenter repositories.

 Click here to show or hide the generic request example


Select the appropriate repo and then get the link to the virtual machine templates.

                    "title": "virtual machine templates",
                    "rel": "virtualmachinetemplates",
                    "type": "application/vnd.abiquo.virtualmachinetemplates+json",
                    "href": "http://localhost:9000/api/admin/enterprises/1/datacenterrepositories/15/virtualmachinetemplates"

Get the templates, and find the appropriate template, which will contain a link to the template disks.

 Click here to show or hide the generic request example

Get the template disks, and find the disk you wish to replace. The above examples are generic examples that should be automatically updated for each new release of Abiquo.

 Get the diskUrl and currentPath of the disk.

curl -X GET -H '' \
    -H "Accept: application/vnd.abiquo.disks+json;version=3.6" \
    -uadmin:xabiquo --verbose 

Response payload:

    "links": [],
    "collection": [
            "links": [
                    "title": "disk",
                    "rel": "edit",
                    "type": "application/vnd.abiquo.disk+json",
                    "href": ""
                    "title": "conversions",
                    "rel": "conversions",
                    "type": "application/vnd.abiquo.conversions+json",
                    "href": ""
                    "title": "m0n0wall",
                    "rel": "virtualmachinetemplate",
                    "type": "application/vnd.abiquo.virtualmachinetemplate+json",
                    "href": ""
                    "title": "m0n0wall-1.3b18-i386-flat",
                    "rel": "diskfile",
                    "href": ""
            "label": "scsi0:0",
            "sequence": 0,
            "path": "8/",
            "diskFormatType": "VMDK_FLAT",
            "diskFileSize": 27262976,
            "hdRequired": 27262976,
            "state": "DONE",
            "diskControllerType": "SCSI",
            "diskController": "lsilogic",
            "creationDate": "2015-09-28T10:33:16.000+0000",
            "bootable": true


2. Create the replacement object

From the above response, we need

  • the href URL from the disk edit link
  • the path

From the example above, we have the following.

    "href": ""
    "path": "8/", 



From this response, the URL from the disk edit link is used as the diskUrl and the path is used as the currentPath in the JSON request payload to modify the template object. 

Enter the space required by the disk as requiredHDInMB.



3. Replace the file

Replace the file using the Appliance manager API.

The URL to post to contains the enteprise ID and the template folder.


The template folder is the folder path on the NFS Repository, without the file name. In the above example:


Use this information to build the request to replace the disk.


curl -k -v -u '' -F "diskInfo=@diskReplace.json" -F "diskFile=@newDiskFile.vhd"

Replace newDiskFile.vhd with the name of your disk file on the local file system. Enter the disk capacity.

Here is an example of the diskReplace file.



Example request:

> POST /am/erepos/8/templates/8/ HTTP/1.1
> Authorization: Basic YWRtaW46eGFiaXF1bw==
> User-Agent: curl/7.35.0
> Host:
> Accept: */*
> Content-Length: 10491775
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------0cfebb4f05bf81ed
< HTTP/1.1 100 Continue
< HTTP/1.1 201 Created
< Date: Tue, 29 Sep 2015 10:54:51 GMT
< Location:
< Content-Length: 0
< Content-Type: text/plain
* Connection #0 to host left intact

Success status code: 201 Created

4. Check the disk file

You can check the new disk file using the details in the Location link.