7.3

Table Of Contents
Example: 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.
Validate an HTTP Bearer Token
You can validate an existing HTTP bearer token.
Prerequisites
n
Request an HTTP Bearer Token.
Procedure
1 Enter the command to validate the HTTP bearer token.
curl --insecure -I -H "Accept: application/json" -H "Authorization: Bearer $token" -H "Cache-
Control: no-cache" "https://$vRA/identity/api/tokens/$token"
2 Examine the response.
A successful request returns status code 204.
Example: Validate Token Request and Response
The following sample displays output based on the example request.
curl --insecure -I -H "Accept: application/json" -H "Authorization: Bearer $token" -H "Cache-Control:
no-cache" "https://$vRA/identity/api/tokens/$token"
HTTP/1.1 204
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Content-Type: application/json;charset=UTF-8
Date: Thu, 13 Apr 2017 21:56:02 GMT
X-Frame-Options: SAMEORIGIN
The server returns one of the following status codes.
Programming Guide
VMware, Inc. 17