vRealize Automation 8 Api Guide

 

 vRA 8.x Api guide


For the purposes of this post I will be using Postman rest api client available to download free. Postman is a very handy rest api client tool that allows you to save api requests as collections saving you time and reducing repetitive nature of constructing api request.

 Once comfortable with the basics you are going to want to familiarize yourself with vRA 8.x api documentation.

  • There is a guide hosted on vRA appliance itself. Simply open a browser and navigate to https://$vRA/automation-ui/api-docs, where $vRA is the hostname of your vRealize Automation appliance.

  • VMware also has a vRA 8 API Programming Guide.

The Basics


  1. Installing postman
  2. Authenticating with vRA 8 api
  3. Submitting vRA 8 api requests




 1. Installing postman



  • If postman is not your preferred api client you can skip this section.
  • Download and launch the postman application
  • Create an account or Skip and go to the app
  • (optional) Create a collection to store & re-use your api requests


















2. Authenticating with vRA 8 Rest API


vRA Rest API leverages Bearer Tokens to authorize the API requests. This is a two-step process first we get our refresh token then we use this to request our Bearer Token.

  • The format of the refresh token api request is a POST to url:


https://vRAFQDN/csp/gateway/am/api/login?access_token

With Headers:

Accept: Application/json 

Content-Type: application/json

And raw data type Body:

{
"username":"admin username",
"password":"admin password"
}



  • You will retrieve the Refresh Token as shown below:





  • Save the Refresh Token value and request our Bearer token:




The format of the bearer token api request is a POST to url:


https://vRAFQDN/iaas/api/login


With Headers:

Accept: Application/json 

Content-Type: application/json


And raw data type of refresh token value from previous request:

{
    "refreshToken": "bQWSIBU4yN75bs90gfAge60ZNIduod9t"
}




This gives us our Bearer Token
.








3. Submitting vRA 8 api requests




Now that we have our Bearer Token we are ready to begin submitting API request.

To leverage the Bearer token we add it to the authorization tab of our postman request:


  • Under Type select Bearer Token and paste in our bearer token value:






The below example will retrieve the list of vRA deployment objects from deployment service api, the format of the deployment api request is a GET to url:

https://vRAFQDN/deployment/api/deployments/


With Headers:

Accept: Application/json
Content-Type: application/json

Authorization set to type Bearer Token with token value populated







We can see the output returned in the response above including our very first vRA deployment object which we recently submitted in the UI.

Hope you find this article of some use, if there is a specific API use-case you would like to see added please leave a comment below.

Comments

Popular posts from this blog

vRealize Automation appliance services not registering

IaaS service not registering

vRA 7.x Certificate Replacement Process