Access Internal REST API’s in vROPS with PowerShell

Access Internal REST API’s in vROPS with PowerShell

Access Internal REST API’s in vROPS with PowerShell

Its been a long time since i blogged as have been very busy with my New Job Role at VMware :).

Being a customer facing role, i see lots of challenges that customers face and my role is to save the world!, one customer at a time 🙂

Recently we had a challenge with one of our customer where we had about 2000 custom-groups which had to be created in vROPS, and it had to be done fast!, so no time for manual efforts.

The REST API exposed for this was an internal API for vROPS and the sad part was that PowerCLI the tool that i love!! and can solve almost anything did not have these exposed at the time being.

Hence i resorted to the PowerShell way to invoke REST API’s

If you explore the vROPS internal API reference guide, you can find details on the XML body which needs to be passed for this invoke.

 

Once you get this output!, you need to build an XML body to be passed to create this custom group, but the tough part is how to you get the values on what you need to pass, for this what i did was basically create a custom group manunally and then i sent a GET request to the internal API to identify the contents of the XML and voila!, i got the details of the XML node data which needs to be passed along with the POST request.

First identify the API call from the API guide.

Next, lets create the REST call using Invoke-RestMethod to call it.

The results for this would be saved in $result.InnerXML.

Next i figured out only the data which i required,

And once i got the required values for the nodes from the above content, i created the POST request to invoke this.

now if you check $result, you should see a success

and now if you check your vROPS dashboard you can see the custom group created successfully!, woah!! now with the magic of for-loop iterate it across 2000 objects and get all things automated! 🙂

I hope you enjoyed this blog post and found this useful for accessing Internal REST API’s in vROPS with PowerShell .

Please follow and like us:

Share this post

Post Comment