VMware Cloud Community
sivakumarss
Enthusiast
Enthusiast
Jump to solution

How to run VRA business report from VRO workflow?

My aim is to create a workflow which will prompt user to select a report from a list.

Then the workflow should run the appropriate VRA custom business report and then mail the output to the requestor.

For this the basic requirement is to run the business report. I am not able to find any plugin or any API (REST?) to invoke the required report.

Any help is very much appreciated.

Thanks

-Siva

Tags (4)
0 Kudos
1 Solution

Accepted Solutions
sivakumarss
Enthusiast
Enthusiast
Jump to solution

Apologies for not updating this thread.

I found that with VRB installed, there is a new endpoint URL that createRestClient can use

com.vmware.vcbm.vcbm.api

Using the created rest client, I can do .getFile("/rest/reports-api/export-csv?name=customreport") to get the report output in CSV format.

Though I can't seem to find a way to specify XLS format or date ranges as input to this API.

-Siva

View solution in original post

0 Kudos
4 Replies
sivakumarss
Enthusiast
Enthusiast
Jump to solution

Not able to find which service is for the ITBM business reports. can you help?

Thanks

0 Kudos
Hejahida82
VMware Employee
VMware Employee
Jump to solution

So you want to run a vRB report via a vRO workflow and not a vRA report?

If it is vRB (ITBM) then you can do this using the API of vRB, the documentation actually contains an example of how to do this using REST calls without vRO (Use Public API to Generate vRealize Business for Cloud Reports​).

You can wrap these REST calls into vRO workflows easily enough, I did something similar for a customer by creating a vRO workflow that was published into vRA as an XaaS blueprint so they could request a report from the vRA catalog page by selecting a report and the email address to send it to

Things to note/be awae of:

  1. The name of the report had to be entered manually, or stored in vRA as a static list. I did not find an API to allow me to pull out a list of possible report names from vRB, the APIs for vRB are not all publicly available for use unlike vRA.
  2. The report had to be exported from vRB and passed to vRO in the response of the REST call so it could then be saved locally and emailed by vRO. I could not make vRB send the report itself (like you can do in the GUI for 7.3). This means the report is saved to the local vRO file system and has to be deleted once emailed to keep things clean.
  3. You need to copy the out of the box vRO workflow for sending a notification to allow you to send an attachment with the email

I can't provide a copy of the workflow but can tell you the general steps used and the key api calls you need (values in <> would be attributes within your workflow containing the relevant values:

  1. Get authorisation token from vRA by sending a POST request to vRA API
    https://<vra fqdn>/identity/api/tokens) 
  2. with a content value of
     '{"username": "' + <username> + '","password": "' + <password> + '","tenant": "' + <tenantName> +'"}'
    The token is contained in the response as the id field.
  3. Request the report from vRB by sending a GET request to vRB API
    https://<vRB fqdn>/itfm-cloud/rest/reports-api/export-csv?name=<report name>
    Pass in the vRA token value in the headers of this request as a value of
     "Bearer " + <token value> 
    and a label of "Authorization" . The contentAsString value provided by the request contains the report data
  4. Save the report data to a csv value (vRO doesn't support office file extensions, you could also use txt file if it made more sense for the report you are using). I suggest using the temp directory of vRO as the location to save the file into. I used the FileWriter method to create the file.
  5. Email the saved report as an attachment. As mentioned I cloned the out of the box workflow and then added a line like the one below to allow the attachment to be included with the attribute <attachment> set as a MimeAttachment type in vRO
    message.addMimePart(<attachment>, "application/json; charset=UTF-8")
  6. Delete the saved report from the vRO file system. I used the File method here, checking if the file exists first and then again once the deletion was completed to make sure it was gone.
0 Kudos
sivakumarss
Enthusiast
Enthusiast
Jump to solution

Apologies for not updating this thread.

I found that with VRB installed, there is a new endpoint URL that createRestClient can use

com.vmware.vcbm.vcbm.api

Using the created rest client, I can do .getFile("/rest/reports-api/export-csv?name=customreport") to get the report output in CSV format.

Though I can't seem to find a way to specify XLS format or date ranges as input to this API.

-Siva

0 Kudos