Performance Cloud VMware – Get Access to the vCloud API


Reference

https://blogs.vmware.com/cloudprovider/2017/10/getting-started-vcloud-director-9-0-api-part-1.htm

Notes

In the example below, we are using a software named Postman and the CAN URL for Performance Cloud VMware but you could use any compatible API platform. The USA URL would work the same way too.

Sherweb will not provide any type of support for the use of the mentioned tool or any other 3rd party software. Please refer to the software vendor's support website for any support requests. 

Requirements

Have Postman installed

Step 1 – Create a new collection & Authenticate to the API

  1. In Postman, create a new collection.


     
  2. Give a name to the new collection and change the authorization type to Basic Auth.

    Une image contenant texte

Description générée automatiquement

  3. Enter the username and password and click on Save.

    The username to enter is your [Performance Cloud VMware username] + [@] + [Performance Cloud VMware organisation]
    Example: john@domain.com@orgname

    Une image contenant texte

Description générée automatiquement

  4. Create a new request.



  5. Execute the folowing query:

    GET https://performancecloud-vdc.sherweb.com/api/versions

     
    Une image contenant texte

Description générée automatiquement

  6. Confirm you properly authenticated with the authorization value in Headers tab.

    Une image contenant texte

Description générée automatiquement

Step 2 - Discover the supported API versions

With the GET call previously performed, validate the API versions supported to make sure your API calls are supported.

Une image contenant table

Description générée automatiquement

Step 3 - Establish a session

In the Headers section, create a new key like this:

Key: Accept

Value: Application/*+xml;version=35.2

Note: version should be the latest version available from Step 2

Une image contenant texte

Description générée automatiquement 

Create a session to vCloud Director using basic auth

Note: Using this method with the x-vcloud-authorization value, the session will be reset after few hours.

Execute the following query to confirm you have successfully created a session to vcloud director:
 

POST https://performancecloud-vdc.sherweb.com/api/sessions
 

You should receive a "200 OK" response to confirm it is successful.

Une image contenant texte

Description générée automatiquement

 

Take note of the x-vcloud-authorization value

Une image contenant texte, capture d’écran, intérieur

Description générée automatiquement

Create a new key in the Headers section like this:

Key: x-vcloud-authorization

Value: value from previous step




Create a session to vCloud Director using bearer token


In Tests tab, enter the following lines and click on Send:

 

var bearer = postman.getResponseHeader("X-VMWARE-VCLOUD-ACCESS-TOKEN")

pm.environment.set("X-VMWARE-VCLOUD-ACCESS-TOKEN",bearer)

Une image contenant table

Description générée automatiquement

 

Get the X-VMWARE-VCLOUD-ACCESS-TOKEN value.


Une image contenant texte

Description générée automatiquement

Go to the Authorization tab. Change the authorization type from Inherit from parent to Bearer Token.

Set the value from previous step and click on Save.


Test query to get org information


Execute the following query:

GET https://performancecloud-vdc.sherweb.com/api/org

The result should look like this:

Step 4 - Perform queries

Here are some queries as examples.

API Explorer

There is also the API Explorer tool that can be enabled on-demand.
The API is documented with Swagger and can be viewed and executed directly from the portal.

Please contact our Cloud Support team to request the API Explorer feature if desired.

Once enabled, you will have access to a new role in the portal: Organization Administrator + API Access

Members of this new role will have access to the API Explorer.

 
Une image contenant texte

Description générée automatiquement