Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Powerbi exportTo api bookmark state error

Hi everyone,

 

I have embded power-bi report into react App using service priciple and I'm using exportTo post api to get report in ppt/pdf format.

let result = await fetch(
      `https://api.powerbi.com/v1.0/myorg/groups/${data.workSpaceId}/reports/${data.reportId.id}/ExportTo`,
      {
        method: "POST",
        headers: headers,
        body: JSON.stringify(formData),
      }
    );
 
formData = {
      format: "PPTX",
      powerBIReportConfiguration: {},
    };
    formData.powerBIReportConfiguration["identities"] = [
      {
        username: data.user.email,
        roles: ["RLS"],
        datasets: ["xyz"],
      },
    ];
    formData.powerBIReportConfiguration["pages"] = [{ pageName: data.page }];
    formData.powerBIReportConfiguration["defaultBookmark"] =
      data.bookMark.body.state;
 

I have used report.bookmark.Capture() and report.bookmarksManager.applyState() to apply and get bookmark state of app based on user interaction.But as I add bookmark state property in FormData I get 

"Error converting value \"H4sIAAAAAAAAA+VZbW/bNhD+K4G+dAOcgqJtvfRbXlqsWLoGcZFhGIKBIs82W1nUKCqJF/i/70hKcfySxk7aJfWCILHIu+PdPXfH8+kmELIqczb9jU0geBMcKvVlwvSXvTDoBMXimkh6UchoN+YJBxqydBhRpFKlkaqogjc3gWF6BOZcVjXLrUBc/POiE7A8P2Uj+2R0DZ2gBF2pguXyH/C0uDPEvzDrBHBd5kozK3JgmAEr9hLp8RlVCV938UTGjbyEAXDjV8+gVNq0z51gKHODLJY1m769LjWqcdNa885tCg5dkvZImIQRzwjtQo8gp5mWluYIDx4pLTnLb8VZaeetIrQTvNNq4uQ2nrOUbwsjzRQfThSyHqOUTyzL4S8WQxhRHu5nrE/20Yt8P4ko3U+BZP0+gRB/kf2TO53M0GW/j0GDE3+kCiG9oXiWMvaftQmqqll8XyyuVQ1fXk+KVeqBqjWHMxjOH5z2M3T+qVaIj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yps0EVeKuOyY6M52pm62uIe3MaD38UdWIS91McovVk76UBlhRXlXtz6k7TK3SfvMFQjtxXS7/1dg57iYW6/MeP1rSuQVlanEuUL/97YumYty11THReal7OyahlXBCGRVv5NqhTgzGxvI/tyq7m6M5EBpMMwTrrdvkiyLs2eUKW+zfTwyBYhjc3J3v7euYQrPOgbzRFdxV7XraraVCXjcMoKWNMhOdAFiK36otnsXwx1o/Z4IAAA\" to type 'Microsoft.PowerBI.ServiceContracts.Api.V1.PageBookmark
 
I have used Express and Node.js for backend server. PLease help me with this @PowerBI 
1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @Anonymous,

As the document said, the bookmark parameter seems allow two methods, name and state. If state not work on your scenario, Have you try to change to use the bookmark name?

Reports - Export To File - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.