vCloud Air requires login requests to be authenticated. Begin the workflow with a login request that supplies user credentials in the MIME Base64 encoding format as specified in RFC 1421.
As a vCloud Air client, you present your credentials one time to log in and view the list of your subscribed compute services in vCloud Air.
The Session element, which the API returns from a successful login, contains a link to the services for that vCloud Air account. The client invokes the service link and receives a list of services. Each service contains a serviceType, serviceId, and an href to the content for that service. The compute serviceType has the following values:
■
| |
■
|
The vCloud Air automated subscription system assigns the value of the serviceId attribute.
This example shows the two parts that are required for logging in to the Compute Service that you have subscribed to with vCloud Air. The first part of the example shows the request and response for HelloUser to log in to vCloud Air at the URL https://vchs.vmware.com/api/vchs/sessions In Request 1, the initial POST requires you enter the Authorization header with an encoded Base64 username:password value.
The second part shows the request and response for HelloUser to pass the authorization token to obtain the compute service list purchased for the user's company account. The service list contains one service for a Dedicated Cloud subscription.
POST https://vchs.vmware.com/api/vchs/sessions Authorization: Basic Vk13YXJlMTIzIQ== Accept: application/xml;version=5.6
201 Created Response Header: x-vchs-authorization:f1c687e31731cc9a5820d233e46ef1dfa131cb45 ... <Session type="application/xml;class=vnd.vmware.vchs.session" href="https://vchs.vmware.com/api/vchs/session" xmlns="http://www.vmware.com/vchs/v5.6" xmlns:tns=http://www.vmware.com/vchs/v5.6 xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance> <Link rel="down" type="application/xml;class=vnd.vmware.vchs.servicelist" href="https://vchs.vmware.com/api/vchs/services" /> <Link rel="remove" href="https://vchs.vmware.com/api/vchs/session" /> </Session>
GET https://vchs.vmware.com/api/vchs/services Authorization: x-vchs-authorization:f1c687e31731cc9a5820d233e46ef1dfa131cb45 Accept: application/xml;version=5.6
200 OK <Services type="application/xml;class=vnd.vmware.vchs.servicelist" href="https://vchs.vmware.com/api/vchs/services" ...> <Service region="US - Las Vegas" serviceId="example-1101-130711-1" serviceType="compute:dedicatedcloud" type="application/xml;class=vnd.vmware.vchs.compute" href="https://vchs.vmware.com/api/vchs/compute/vchs-2" /> </Services>