VMware Cloud Director API - POST-Login
POST /sessions
- Operation:
- POST /sessions
- Description:
-
Log in and create a Session object.
To authenticate to the API service, POST a request to its login URL. The request body must contain a MIME Base64 encoding of your credentials in the form:
user@organization:password
To obtain the login URL, make an unauthenticated GET request to the vCloud Director api/versions URL. The response to this request lists the API versions that the server supports, and provides a login URL for each version.
- Since:
- 1.5
- Federated:
- Yes
- Deprecated:
- 33.0
- Input parameters
-
- Consume media type(s):
- None
- Input type:
- None
- Output parameters
-
SessionType
The response includes an authorization token in this format:
x-vcloud-authorization: token
Include this header in all subsequent requests.
- Produce media type(s):
-
application/vnd.vmware.vcloud.session+xml
application/vnd.vmware.vcloud.session+json
- Output type:
- SessionType
- Examples
-
- Request
-
HTTP 1.1
POST /api/sessions
Headers:
Authorization: Basic dmNsb3VkQFN5c3RlbTp2Y2xvdWQ=
Body:
- Response
-
HTTP/1.1 200 OK
Headers:
Content-Length: 1363
Content-Type: application/vnd.vmware.vcloud.session+xml;version=5.5
Set-Cookie: vcloud-token=eVBkZn2wahPAU+IvbURo7ekslpuoHERMB2DZEFlJuHs=; Secure; Path=/
Vary: Accept-Encoding
x-vcloud-authorization: eVBkZn2wahPAU+IvbURo7ekslpuoHERMB2DZEFlJuHs=
Body:
<?xml version="1.0" encoding="UTF-8"?><Session
xmlns="http://www.vmware.com/vcloud/v1.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
href="https://vcloud.example.com/api/session/"
org="System"
type="application/vnd.vmware.vcloud.session+xml"
user="vcloud"
xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://https://vcloud.example.com/api/v1.5/schema/master.xsd">
<Link
href="https://vcloud.example.com/api/org/"
rel="down"
type="application/vnd.vmware.vcloud.orgList+xml"/>
<Link
href="https://vcloud.example.com/api/session/"
rel="remove"/>
<Link
href="https://vcloud.example.com/api/admin/"
rel="down"
type="application/vnd.vmware.admin.vcloud+xml"/>
<Link
href="https://vcloud.example.com/api/admin/extension"
rel="down"
type="application/vnd.vmware.admin.vmwExtension+xml"/>
<Link
href="https://vcloud.example.com/api/org/a93c9db9-7471-3192-8d09-a8f7eeda85f9"
name="System"
rel="down"
type="application/vnd.vmware.vcloud.org+xml"/>
<Link
href="https://vcloud.example.com/api/query"
rel="down"
type="application/vnd.vmware.vcloud.query.queryList+xml"/>
<Link
href="https://vcloud.example.com/api/entity/"
rel="entityResolver"
type="application/vnd.vmware.vcloud.entity+xml"/>
<Link
href="https://vcloud.example.com/api/extensibility"
rel="down:extensibility"
type="application/vnd.vmware.vcloud.apiextensibility+xml"/>
</Session>