Log In To the Compute
Service in
vCloud
AirVirtual
Private Cloud OnDemand

All vCloud API
requests to the
vCloud
Air
Compute Service must include an
Authorization header
that supplies your user credentials in the form that the
vCloud
Air
Compute Service requires.

The Hello vCloud workflow
begins with a login request that supplies your user credentials and returns a
Session object.

Prerequisites

Verify that the following
conditions are met.

■

You have
vCloud
Air
login credentials that are valid for access to the
vCloud
AirVirtual
Private Cloud OnDemand service option.

Note

If you want to run
the Hello vCloud examples, you must have at least the set of rights associated
with the
vCloud
Air End
User role, and your organization must contain at least one VDC that has at
least one network. Your organization must also contain a catalog in which at
least one vApp template is available. For information about creating VDCs and
networks, see
Administering a Tenant Organization.
For information about adding a vApp template to a catalog, see
Provisioning an Organization.

■

You have retrieved the
following information from
vCloud
Air.

■

The value of the
vchs-authorization
header returned in the response to your initial login to the
vCloud
Air IAM
service.

■

The
instanceAttributes of
an instance of the
vCloud
Air
Compute Service, which contains the
orgName and
sessionUri you need to
create a vCloud API login session.

The response code
indicates whether the request succeeded, or how it failed.

A successful login request
returns an authorization token that you can use in subsequent requests. It also
returns a
Session element, which
contains one or more
Link
elements, each of which provides a URL that you can use to explore the objects
accessible to you.

Example: Log In To the
vCloud
Air
Compute Service

A request to log in to the
vCloud API combines your
vCloud
Air
authorization token with other information that you retrieved from
vCloud
Air,
authenticates you to an instance of the
vCloud
Air
Compute Service, and creates a vCloud API
Session object. Before
you can make this request, you must use the
vCloud
Air APPI
to retrieve the following values:

The response code indicates
whether the request succeeded, or how it failed.

■

If the request is
successful, the server returns HTTP response code 200 (OK) and headers that
include an authorization header of the following form:

x-vcloud-authorization: token

This header or the
vchs-authorization
header must be included in each subsequent vCloud API request.

■

If the
Authorization header is
missing, the server returns HTTP response code 403.

■

If the credentials
supplied in the
Authorization header
are invalid, or if the
vchs-authorizationtoken
has expired, the server returns HTTP response code 40 1.

Important

The
vCloud
Air
Identity Management system's
vchs-authorization token expires 15 minutes after its
issue time, even when API clients are active. Client requests that present an
invalid or expired authorization token return HTTP status code 401
(Unauthorized) and the client must re-authenticate to the
vCloud
Air
Identity Management system and obtain a new token.