Chapter 3. API Clients

3.1. The CloudStack API

The CloudStack API is not a standard like OGF OCCI or DMTF CIMI, but is easy to learn. A mapping exists between the AWS API and the CloudStack API, as we will see in Chapter 4. Recently, a Google Compute Engine interface was also developed that maps the GCE REST API to the CloudStack API described here. The API docs are a good place to start learning the extent of the API. Multiple clients exist on GitHub to use this API, and you should be able to find one in your favorite language. The reference documentation for the API and changes that might occur from version to version is available online. This short section is aimed at providing a quick summary to give you a base understanding of how to use this API. As a quick start, a good way to explore the API is to navigate the dashboard with a firebug console (or similar developer console) to study the queries.

In a succinct statement, the CloudStack query API can be used via HTTP GET requests made against your cloud endpoint (e.g., http://localhost:8080/client/api). The API name is passed using the command key, and the various parameters for this API call are passed as key/value pairs. The request is signed using the secret key of the user making the call. Some calls are synchronous; while some are asynchronous, this is documented in the API docs. Asynchronous calls return a jobid, and the status and result of a job can be queried with the queryAsyncJobResult call. Let’s get started and give ...

Get 60 Recipes for Apache CloudStack now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.