1

Is there a way to get different visuals from power bi report based on the report details. I know there is an api to get report details which includes embedUrl and token, but how can I get details of the visuals separately through API call.

I do not want to embed the Power BI report, I want to call an API to get report details and then get visuals from that report without embedding the power bi report

Learn AspNet
  • 1,192
  • 3
  • 34
  • 74

2 Answers2

2

Visuals are not available until the report is rendered. The API will not render it for you, so you must do it yourself by embedding the report. Then you can use the JavaScript client to give you the list of visuals in a page by calling getVisuals method. You can navigate trough the pages waiting them to be rendered (wait for rendered event).

Andrey Nikolov
  • 12,967
  • 3
  • 20
  • 32
  • Thank you, can you give me an example to render the report and not show it on the page, is there a way I can do that in ReactJS? – Learn AspNet Jul 29 '20 at 13:22
  • I am not a web developer. In a c# desktop app I will use offscreen browser, cefsharp for example. Can you render it in a hidden
    for example, or something like that?
    – Andrey Nikolov Jul 29 '20 at 14:44
  • That does not work, can you try to answer the following https://stackoverflow.com/questions/63178432/embed-a-power-bi-report-in-react-js-to-get-report-instance – Learn AspNet Jul 30 '20 at 17:39
0

You cannot get them with the REST API but you can with the Javascript API

If you did the following to embed your report

var report = powerbi.embed(reportContainer, config);

You could then do the following PowerBI Javascript API call to get all of the visuals on the first page of the embedded report and store them in a MyReportVisuals variable to do whatever you want with.

report.getPages().then(pages => {
            pages[0].getVisuals().then(visuals => MyReportVisuals = visuals)
        });
vvvv4d
  • 3,881
  • 1
  • 14
  • 18
  • I am using a react library powerbi-client-react to embed report but I am doing that in edit mode so when a user makes changes to the report, I need to get report instance so I can get visuals. Is there a way to get report instance after user has made changes in the report – Learn AspNet Oct 14 '20 at 03:17