Logging in to the VMware vCloud Director API using VMware vCloud Air credentials (2054827)
- Log in to the VMware vCloud Air portal.
- Click a virtual datacenter to open it.
- Under Related Links, click vCloud Director URL.
Note: The URL looks similar to https://p1v17-vcd.vCouldAir.vmware.com:443/cloud/org/21-170/. For the purposes of this article, the "vcloud-url" is everything before the 443, but note the org name (21-170 in this example) as it is used in the example later.
- Open a REST client of choice.
- Issue a GET request to https://vcloud-url/api/versions.
- Locate the LoginUrl item(s) to verify the URL to use with the version of the API you want to work with. For example:
- Note the LoginURL.
- Using a REST client, prepare a POST request to the login URL noted above.
- Create an "Authorization" header item using "Basic Authentication" within the REST client
- The username is in this format: email@example.com@org_name (21-170 in this example)
- The password is the same password used to log into the VMware vCloud Air portal
- Create an "Accept" header item with the content "application/*+xml;version=5.1"
Note: The version can be any applicable API version as returned by the version check above.
- Issue the POST request and verify the return information.
- Assuming a response 200, take note of the "x-vcloud-authorization" header value. This is the token to be used with further API calls.
If the login request was successful, this process can be duplicated programmatically in the language you are using to develop the software making these vCloud Director API calls. When the vCloud Director API login URL is known, it should not change. The only steps you need to repeat at the login steps. The sections prior to the login are strictly for gathering information related to the API setup on vCloud Air.