Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Logging in to the VMware vCloud Director API using VMware vCloud Hybrid Service credentials (2054827)

Purpose

This article provides steps to log in to the VMware vCloud Director API using VMware vCloud Hybrid Service credentials.

Resolution

Note: Using a REST client is necessary to obtain or verify some of the configuration information.
 
To obtain the vCloud Director URL:
  1. Log in to the VMware vCloud Hybrid Service portal.
  2. Click a virtual datacenter to open it.
  3. Under Related Links, click vCloud Director URL.

    Note: The URL looks similar to https://p1v17-vcd.vchs.vmware.com:443/cloud/org/21-170/. For the purposes of this article, it is safe to discard anything after the 443, but note the org name (21-170 in this example).
To query the vCloud Director API versions:
  1. Open a REST client of choice.
  2. Issue a GET request to https://vcloud-url/api/versions.
  3. Locate the LoginUrl item(s) to verify the URL to use with the version of the API you want to work with. For example:

    <VersionInfo>
            <Version>5.1</Version>
            <LoginUrl>https://p1v17-vcd.vchs.vmware.com:443/api/sessions</LoginUrl>

  4. Note the LoginURL.
To issue the API login request:
  1. Using a REST client, prepare a POST request to the login URL noted above.
  2. Create an "Authorization" header item using "Basic Authentication" within the REST client
    • The username is in this format: username@domain.com@org_name (21-170 in this example)
    • The password is the same password used to log into the VMware vCloud Hybrid Service portal

  3. 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.

  4. Issue the POST request and verify the return information.
  5. 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 VMware vCloud Hybrid Service.

Additional Information

For more information, see the VMware vCloud Director 5.1 API Programming Guide.

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 0 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
  • 0 Ratings
Actions
KB: