5.6
Table Of Contents
- vCloud Air Platform Programmer's Guide
- Contents
- About this Programmer's Guide
- About the vCloud Air Platform APIs
- The VMware APIs for Cloud Automation
- XML Namespace Identifiers
- Overview of Object Types
- Link Relationships in the Object Types
- API Versioning
- Roles for the APIs for Cloud Automation
- Authentication and Authorization
- vCloud Air Platform APIs Schema Reference
- Java Code Samples for Cloud Automation
- About the Examples in this Programmer's Guide
- Hello vCloud Air : A RESTful Workflow
- Index
3 Create a session to the virtual data center by issuing a POST request to the URL in the Vdc element for
that virtual data center:
POST href=https://vchs.vmware.com/api/vchs/compute/compute-uuid/vdc/vdc-uuid/vcloudsession
The returned response includes the session for the virtual data center:
<VcloudSession
...>
<VdcLink
authorizationToken=vcloud-token
authorizationHeader="x-vcloud-authorization"
rel="vcloudvdc"
...
href="https://vcloud-examplehost1.example.com/api/vdc/vdc-uuid" />
</VcloudSession>
Include the x-vcloud-authorization token in all subsequent API requests as a request header.
4 Issue a GET request to the following URL for the version of the vCloud instance:
GET https://vcloud-examplehost1.vmware.com/api/versions
NOTE You must query the vCloud version before issuing subsequent calls that require setting the
correct version header.
The response contains the vCloud version:
<SupportedVersions
...
"https://vcloud-examplehost1.vmware.com/api/versions/schema/versions.xsd">
<VersionInfo>
<Version>1.5</Version>
<LoginUrl>https://vcloud-examplehost1.example.com/api/sessions
</LoginUrl>
...
</VersionInfo>
<VersionInfo>
<Version>5.x</Version>
<LoginUrl>https://vcloud-examplehost1.example.com/api/sessions
</LoginUrl>
...
</VersionInfo>
</SupportedVersions>
5 Issue a GET request to the URL for the virtual data center session:
GET href=https://vcloud-examplehost1.example.com/api/vdc/vdc-uuid
In the request, include the vCloud authorization token (Step 3) and the vCloud version (Step 4) by
using the following format:
Authorization: x-vcloud-authorization:vcloud-auth-token
Accept: application/*+xml;version=5.x
The returned response includes the details for the virtual data center. See Response 5 below.
Chapter 2 Hello vCloud Air : A RESTful Workflow
VMware, Inc. 19