Forum Discussion
Embedding API: get list of visuals without embedding entire report?
Helllo everybody
I'm developing a web application where I want to embed some single visuals from a report in a web page, using the official powerbi-client library.
The problem I am facing is that, in order to embed a visual, I need to know the visual name. So I would like to get the list of visuals in code. However, from what I understand from the documentation, it looks like to do I first need to embed a report, because only then I can get the list of visuals with something like this:
let report = embeddedReport.getReport();
let pages = await report.getPages();
pages.forEach(async page => {
let visuals = await page.getVisuals();
});
now I have the visuals name and I can use them to embed visuals, however I had to embed a report (that I didn't need) in order to get them.
My question is: is there a way to use the client to get a report and list its visuals without embedding it in the page first? I know I can technically just embed it in an invisible html element and remove it after, however that seems hacky... there must be a more direct way, right?
- Anonymous4 years ago
Hi Master_T,
Perhaps you can try to use rest API to get specific reports and correspond report page contents, it will show the visual detail information that includes the names.
Reports - Get Pages In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Reports - Get Report In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Regards,
Xiaoxin Sheng
2 Replies
- AnonymousNot applicable
Hi Master_T,
Perhaps you can try to use rest API to get specific reports and correspond report page contents, it will show the visual detail information that includes the names.
Reports - Get Pages In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Reports - Get Report In Group - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Regards,
Xiaoxin Sheng
- Hariharan_RSolution Sage
Hi,
You still can refer external tools to get the report pages and visual names.
Refer - https://dataap.org/blog/2022/03/10/export-power-bi-report-visual-as-a-image-rest-api-automated-way/
Thanks
Hari