Few days ago a customer asked me “Jose, can we do request of virtual machines via rest API?“. I said, yeah!!! but just for curiosity I asked why?
For a customer that has vRA 8 self service portal, brand new and all the fancy icons, day 2 operations and a bunch of features? Why would him/her asking about API 🙂 That really got me thinking and here I am about a new blog post for you my dear readers.

There use case was pretty simple to be honest. They have a bunch of Developers that create and destroy 1000+ virtual machines per day, hence clicking here and there on vRA 8 indeed could be a painful exercise or raise frustrations internally.
So to keep short, hereby the steps you will need to proceed for such demand.
1 – You need to be able to authenticate into vRA 8 platform and obtain a “Bearer Token“. Follow the link and you will see how! Thanks to @vandegaerm for his previous blog post.
2 – After you have obtained the Bearer Token, you need to know HOW TO FIND the API to use during your request. In that case, I always keep in mind two of my favorites URL:
- Swagger : https://your-vra8-environment/automation-ui/api-docs
- vRealize Automation API programming Guide: https://vdc-download.vmware.com/vmwb-repository/dcr-public/4e3fc812-7817-4ad3-92af-766007499000/57daec73-115a-4e1b-ae43-9b2ced09dc9f/Programming-Guide.pdf
3- In my case, I just created a simple structure in my postman ( if you want, just use curl commands too, it’s just the same).

4- To Start with: I would like to discover the “id” for the catalog item that I would like to request.
- GET: https://your-vra8-environment/catalog/api/items

5 – Then, I would like to get the specifics of that cloud template, more precisely what are the inputs required, such as CPU & Memory
- GET: https://your-vra8-environment/catalog/api/items/81c45e92-ad0f-320a-b4f1-8db41c39cedc

6 – Request the virtual machine with the necessary inputs
- POST : https://your-vra8-environment/catalog/api/items/81c45e92-ad0f-320a-b4f1-8db41c39cedc/request


And here it is!!! Ready to go and can be easily repeatable task for our developers!

Just remember to have an Unique Deployment Names + to delete previous deployments 🙂

You just need the Deployment ID for deletion
- DELETE: https://your-vra8-environment/deployment/api/deployments/2b33fa62-15a1-4677-88f4-09fc790f61e7
That’s it for today and I hope you have enjoyed How to Request VMs via API in vRealize Automation 8.
See you at next blog and Thanks for reading,
Regards, Jose Cavalheri
Thanks for sharing !!
LikeLike