How to access vCloud Director through the vCloud API
To perform some tasks within your UKCloud for VMware environment, you may need to access vCloud Director through the vCloud API. This guide shows you how to access the vCloud API.
Finding your vCloud API credentials
Before using the vCloud API, you first need to find your API credentials.
Log in to the UKCloud Portal.
For more detailed instructions, see the Getting Started Guide for the UKCloud Portal.
Select your account.
In the top right corner of the page, click your username and then select API.
The API page provides a view of your personal credentials for accessing the vCloud API. In particular, the page provides the following information for each compute service:
API URL - Use this URL at the beginning of your calls to the vCloud API.
This URL will be different depending on the region in which your compute service is located.
API Username - The user ID to use to authenticate yourself with the vCloud API.
The compute service ID is appended to the end of the username. This is because you may have access to multiple compute services.
Username - The API username without the appended compute service ID.
Org ID - Use this to uniquely identify the compute service (or vOrg) when using the vCloud API.
Password - For authentication with the vCloud API. This password is the same as the one you use to log in to the UKCloud Portal.
Make a note of the Org ID, the API URL and your API Username.
Obtaining an authorisation token
Now that you have your API credentials, you can start interacting with the vCloud API. First you need to obtain an
Send the following request to the vCloud API:
POST https://<vcloud_api_url>/api/sessions Authorization: Basic <encoded_credentials> Accept: application/*+xml; version=5.6
Parameter Description Example
The URL you use to access the vCloud API that you noted in Finding your vCloud API credentials
Your login credentials that you noted in Finding your vCloud API credentials in the format:
<username>@<compute_service_id>:<password>These credentials must be supplied in a MIME Base64 encoding, as specified in RFC 1421
POST https://api.vcd.portal.skyscapecloud.com/api/sessions Authoriziation: Basic dXN1cjpwYXNzCg== Accept: application/*+xml; version=5.6
The vCloud API response includes your
x-vcloud-authorizationtoken, for example:
x-vcloud-authorization: cn9uYmdugN8E2j96+5Lqrc3YBvFsEgDHXzyfJrJ/6bM=\ Content-Type: application/vnd.vmware.vcloud.session+xml;version=5.6
You must send this token in a header with any subsequent requests to authenticate yourself with the vCloud API.
If you have any comments on this document or any other aspect of your UKCloud experience, send them to firstname.lastname@example.org.