Abiquo Documentation Cookies Policy

Our Documentation website uses cookies to improve your experience. Please visit our Cookie Policy page for more information about cookies and how we use them.

Abiquo 4.4

Skip to end of metadata
Go to start of metadata

Before you begin working with the Abiquo API, please read Get Started with the Abiquo API, which shows you how to obtain information about your environment's resources and the API by using the Abiquo UI and API together.

To perform tasks using multiple requests using the Abiquo API, work through the API Tutorials section.

This API Examples section contains individual reference examples that may also be included in relevant methods in the API Reference section.

The example pages are named with the prefix "Ex" and the API methods they illustrate, or with the REST option (e.g. GET) and an abbreviation of the URL of the API resource and method, as well as abbreviated media types and formats.

The simple cURL command examples are provided to help new developers get an overall picture of the Abiquo API. And they also informally document the navigable resource links in Abiquo data media types.

These examples are built from the output of the Abiquo integration tests. This means that dummy entities, strange text strings, or empty lists may at times appear in the examples.

For simplicity, user and password authentication is shown in the examples. However, for production systems, OAuth is recommended. See Authentication.

To enable cut and paste to a shell, backslashes are placed at the end of each line to escape the new line. Request examples should contain single quotation marks, not back ticks. However, if problems occur, try checking and modifying the command in a text editor before pasting it in a shell.

Finally, remember that you should always use the version number with your media types in requests to the Abiquo API in order to avoid compatibility issues in future versions. If you do not supply the version number, Abiquo will use the latest version, which may cause your integration to suffer an unexpected upgrade!

Data payloads

The PUT and POST requests usually contain a request payload, which is visible in its own separate section of an example. The cURL command has a "-d" parameter, which indicates the request payload. The "@" symbol means that the following text is a file name. To run the query, you can create a file with the name requestpayload.<format>, where format could be json, xml, text, etc. 

Or you could put the request payload inline, moving any optional authentication line (e.g. -u user:password --verbose) above the payload line and adding a backslash at the end. The payload line should contain -d and the data entity enclosed in single quotation marks. To ensure JSON compatibility, double quotation marks should be used in JSON strings. You can validate your data entities with JSON or XML formatters or checkers. 

Please remember that the example payloads are not specially designed templates for creating a new resource or modifying a resource. For create requests, you may find additional examples of simple requests in the API Reference pages, in the Abiquo API Tutorials, or you may be able to find examples of simple entities by looking at requests made by the Abiquo UI. For modify requests, you should perform a GET of an existing object in your environment and then make your changes. See also Get Started with the Abiquo APIThe Abiquo API will return a response to POST requests in the Accept media type you specify in your requests. When you use cURL, the response payload will be raw data. You can then pipe this output to a formatter or cut and paste to format it in an online tool.

Example cURL command

So here is an example of how a cURL command might look for a test system, where the insecure -k connection is used with https and the request data is inline.

curl -X POST --verbose -k https://my.abiquoserver.com/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines \
     -H 'Content-Type: application/vnd.abiquo.virtualmachine+json; version=3.6' \
     -H 'Accept: application/vnd.abiquo.virtualmachine+json; version=3.6' \
     -u admin:xabiquo \
     -d '{"label":"Core_new","links":[{"title":"Core","rel":"virtualmachinetemplate","type":"application/vnd.abiquo.virtualmachinetemplate+json",
          "href":"http://example.com/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1"}],"vdrpEnabled":true}' | python -m json.tool