vRA 8 API getting started

I wanted to keep track of what needs to be done prior to actually being able to query API on vRA 8. Ive been having a hard time finding the documentation i needed in the past. If you are looking for the Cloud version it can be found here

First step is to get an API token for the specific username. We can do this by using curl or postman. The call would look similar:

curl --location -k --request POST 'https://vra_url/csp/gateway/am/api/login?access_token' --header 'Content-Type: application/json' --data-raw '{
"username": "username",
"password": "password",
"domain": "domain name or system domain"
}'

The command will output a refresh_token. Example:

{"refresh_token":"DJzTxR..."}

We will use this token to generate a bearer token

curl --location -k --request POST 'https://vra_url/iaas/api/login' --header 'Content-Type: application/json' --data-raw '{
        "refreshToken": "DJzTxR..."
}'

This will output a bearer token than can be used to run additional API calls Example:

{"tokenType":"Bearer","token":"eyJ0eXAiO..."}

Full API guide can be found at https://vra_url/automation-ui/api-docs/ or https://developer.vmware.com/api/


Leave a Reply