Syntax for Requesting an HTTP Bearer Token

An HTTP bearer token is required by the REST client to use the vRealize Automation REST API. You obtain a bearer token by authenticating to the identity service.

Input

Use the supported input parameters to control the command output.

Parameter Description
URL https://$vRA/identity/api/tokens
$vRA appliance name.domain name of the vRealize Automation server.
usrname Tenant administrator user name.
passwd Tenant administrator password.
tenantURLtoken Tenant URL token determined by the system administrator when creating the tenant such as, support.

Output

The following information is displayed as a result of your HTTP bearer token request.

Parameter Description
expires Contains the ISO 8601 timestamp indicating when the token expires.
id Contains the HTTP bearer token to use in Authorization header in subsequent requests.
tenant Displays the tenant ID associated with the token.

Response Status Codes

One of the following codes are displayed as a result of your HTTP bearer token request.

Status Code Description
200 OK Your request succeeded and the resource was updated. The response body contains the full representation of the resource.
400 BAD REQUEST The data you provided in the POST failed validation. Inspect the response body for details.
401 UNAUTHORIZED The request could not authenticate the user or authentication credentials required.

curl Command to Request HTTP Bearer Token

The following example command requests an HTTP bearer token.

curl --insecure -H "Accept: application/json" -H 'Content-Type: application/json' --data '{"username":"usrname","password":"passwd","tenant":"tenantURLtoken"}' https://$vRA/identity/api/tokens

When your request succeeds, the system returns the expiration date and time of the token, and the HTTP bearer token.