Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The URL to post to contains the enterprise ID and the template folder in the following format.

Code Block
/am/erepos/{enterpriseId}/templates/{templateFolder}

The For template folder is the folder path on the NFS Repository, without the file name. So from our example with the following “href” and “path”:

Code Block
"href": "{base_api_url}/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/72/disks/74"
"path": "1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9/4ba3b6e1-6f06-47d9-8703-9e9eae1c2a9b-snapshot-yVM2b8c91aa4-14b1-44a6-b27b-aa12c7ca3433-flat.vmdk"    

The “folder path” is as follows:template folder is the folder path on the NFS Repository, without the file name.

Code Block
1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9

And So the format of the full URL to post to will be :template path containing the prefix “/am/erpos/{enterpriseId}/templates and the folder path

Code Block
/am/erepos/1/templates/1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9

...

Code Block
/am/erepos/1/templates/1/bundle/abc%2520abc

6. Replace the disk

This request is to the Appliance Manager remote service, so we need to use its URL.

In the following cURL, the base_url_NO_API is the URL of the Abiquo API server, without the any /api path. For example, https://abiquoremoteservice.example.com.

We recommend that you use double quotation marks around all the parameters, including the file parameters for diskInfo and diskFile.

Code Block
curl -v -k -X POST '{base_url_NO_API}/am/erepos/1/templates/1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9' \
  -H 'Authorization: Token {api_token}' \
  -F "diskInfo=@diskReplace.json" -F "diskFile=@newdisk.vmdk"

...

Code Block
languagejs
{ 
    "virtualMachineTemplateUrl":"{base_api_url}/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/72",
    "diskUrl":"{base_api_url}/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/72/disks/74",
    "currentPath":"1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9/4ba3b6e1-6f06-47d9-8703-9e9eae1c2a9b-snapshot-yVM2b8c91aa4-14b1-44a6-b27b-aa12c7ca3433-flat.vmdk",
	"diskControllerType": "IDE",
    "diskFileFormat":"VMDK_STREAM_OPTIMIZED",
	"label": "Hard disk 1",
    "requiredHDInMB":120,
    "sequence":0
} 

Example request:

We recommend that you use Use double quotation marks around all the parameters, including the file parameters for diskInfo and diskFile., especially if the disk file name contains spaces!

Code Block
curl -v -k -X POST 'https://abiquo.example.com:443/am/erepos/1/templates/1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9' \
  -H 'Authorization: Token {api_token}' \
  -F "diskInfo=@diskReplace.json" -F "diskFile=@newdisk.vmdk"

> POST /am/erepos/1/templates/1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9 HTTP/1.1
> Host: abiquo.example.com
> User-Agent: curl/7.85.0
> Accept: */*
> Authorization: Token a2e19816735381c1d074441cbd002aa006febf2c4888bc2d79b9d2dfbcd9cbed84cbb0089197da8f0406f7a78ae2b25a64df188f10233541e5c45639b013b0c0
> Content-Length: 118752233
> Content-Type: multipart/form-data; boundary=------------------------bb8e15ec8adeba87
> Expect: 100-continue
> 

< HTTP/1.1 100 Continue
< HTTP/1.1 201 
< Date: Wed, 25 Jan 2023 14:44:47 GMT
< Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
< Location: https://abiquo.example.com/am/erepos/1/templates/1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9/8611a4ed-adbd-49aa-a22e-81fd4b60e833-newdisk.vmdk
< Content-Length: 0
<

...