...
Log in to Abiquo and open developer tools in your browser
Go to Network and record requests
Select and edit the template.
From the developer tools console, select the request to get the disks.
Here you will find the:Template URL and disk URL
Current path on the repository file system
Complete the JSON object with the data from your API. For example, from the values above
Code Block { "virtualMachineTemplateUrl":"https://mjsabiquo.lab.abiquoexample.com/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/72", "diskUrl":"https://mjsabiquo.lab.abiquoexample.com/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/72/disks/74", "currentPath":"1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9/daf2f2fb-d3d0-4263-a466-d1b27a0d6864-new+dsl+disk.vmdk", "diskController": "lsilogic", "diskControllerType": "SCSI", "diskFileFormat":"VMDK_STREAM_OPTIMIZED", "diskFilePath": "", "label": "Hard disk 1", "requiredHDInMB":120, "sequence":0 }
Save it to a file called diskReplace.json
...
To create the URL for the request, you will need:
The IP address of the remote services serverURL to reach the Remote Services server with the AM remote service.
Thers_url
is the URL of the AM, without any/api
path. For example,https://mjsremoteservices.lab.example.com
.The folder part the path attribute
The basic URL format is as follows
...
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{rs_url}https://mjsremoteservices.lab.example.com/am/erepos/1/templates/1/bundle/e05785d2-b49a-4034-9bb9-3440e1693589-4ba3b6e1-6f06-47d9-8703-9e9 |
...
Obtain an authorization token
You will also need an authorization token, which you can get from any recent request.
Use this to replace the {api_token} in the following steps
Replace the file
This request is to the Appliance Manager remote service, so we need to use its URL, which may be the URL of the server or of a proxy.
In the following cURL, the base_url_NO_API
is the URL of the AM, without any /api
path. For example, https://remoteservices.example.com
.If you wish to use token authentication, which is more secure and required for 2FA, do these steps.
To obtain an authorization token, send a GET request to the API login resource.
Use basic authentication and get the token from the X-Abiquo-Token header.
Code Block |
---|
curl --verbose -X GET "https://abiquo.example.com:443/api/login" -u adminuser:password -k |
If you are using 2FA, you can get the 2FA verification code in the usual way (by email or from Google Authenticator).
Log in again and send the 2FA verification code.
Code Block |
---|
curl --verbose -X GET "https://abiquo.example.com:443/api/login" -H "X-Abiquo-OTP: your2FAcode" |
Now you can get the token from the X-Abiquo-Token header of the response.
In your API requests, use the token in a header with the following format.
In this example we have shortened the token.
In the workflow below, we represent the token with {api_token}
.
Code Block |
---|
-H 'Authorization: Token a2e19816735381c1d074441cbd002aa01f9ed7dc4cd9f4e0683c3c88...' |
For more details, see Authentication.
Note |
---|
The API token may expire during the process, and you may need to obtain a new token and use it in your requests |
Tip |
---|
You can also get the token from the UI! Go to the browser Developer console on the Network tab and in the request responses look for the X-Abiquo-Token header. |
...
Replace the file
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 'https://mjsremoteservices.lab.abiquoexample.com/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 |
---|
curl -v -k -X POST 'https://mjsremoteservices.lab.abiquoexample.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://mjsremoteservices.lab.abiquoexample.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 < |
...