top of page
  • Brock Peterson

Generate Reports with the vROps Cloud API

So many uses cases for the vROps API, we've discussed using it to delete Adapter Instances and Manage Content, but today we'll focus on using it to generate Reports. Specially, we'll be using the vROps Cloud API, but these same calls will work with your vROps API.


Once you've logged into your VMware Cloud Services Portal you can generate tokens for subsequent use. We've covered this in a previous blog and won't do so again here. Assuming you've logged in, go to your vROps Cloud API, which will be the following: https://www.mgmt.cloud.vmware.com/vrops-cloud/suite-api/doc/swagger-ui.html



Feel free to use use cURL or Postman, but I'm going to execute all of my commands from within the Swagger based UI itself.


Just to make sure I'm properly authenticated, let's run a GET /api/auth/currentuser.



Now let's find the Report Definition we want to run via GET /api/reportdefinitions, the one I'm looking for is called "Utilization Report - vSphere Hosts".



We'll need the Report Definition ID for later: "id": "8dc625e7-805b-420e-9fb2-917f0be1cd8c".


If you want details for just that specific report you can run a GET /api/reportdefinitions/8dc625e7-805b-420e-9fb2-917f0be1cd8c.



Next we need the Resource ID against which we will run our report, let's go get the Resource ID for vSphere World. We'll run a GET /api/resources/groups.



You can search for any group you want here, but I'd like to run my Report against the entire environment, so I'm selecting vSphere World which is: 9864598c-fa9e-4e47-b19f-2daee243ae11. We now have what we need to generate the report:

  • Report Definition ID: 8dc625e7-805b-420e-9fb2-917f0be1cd8c

  • Resource ID: 9864598c-fa9e-4e47-b19f-2daee243ae11

We'll run a POST /api/reports to create the report, mine looks like this.



You'll notice that it's QUEUED. Going over to the vROps UI, we can see it's already complete.



You'll also notice that your Report has an ID associated with it.



We'll use this ID to download the Report we just created via GET /api/reports/{id}/download, mine looks like this.



Click Download file and you'll have the Report we just created.



So much we can do with the vROps Cloud API, try it out!



828 views

Comments


bottom of page