vRA 8 + Request VM via Rest API

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:

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.

5 – Then, I would like to get the specifics of that cloud template, more precisely what are the inputs required, such as CPU & Memory

6 – Request the virtual machine with the necessary inputs

Loveheart GIFs - Get the best GIF on GIPHY

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

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s