Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example payload for the Export To File In Group API endpoint in the Power BI REST API for exporting a paginated report
{
"format":"PDF",
"powerBIReportConfiguration":{
"settings":{
"locale":"en-US",
"excludeHiddenPages":"true"
},
"defaultBookmark":"H4sIAAAAAAAAA+1cW2/bOhL+K4EXi74Ei+FVZJ+2Tdo9xSanu0k…",
"pages":[
{
"pageName":"ReportSection2",
"bookmark":{ "name":"Bookmark3" }
}
],
"identities":[
{
"username":"john@contoso.com",
"roles":[ "sales" ],
"datasets":[ "cfafbeb1-8037-4d0c-896e-a46fb27ff229" ]
}
]
},
"paginatedReportConfiguration":{
"formatSettings":{
"AccessiblePDF":"true",
"PageHeight":"11in",
"PageWidth":"8.5in",
"MarginBottom":"2in"
},
"parameterValues":[
{
"name":"City",
"value":"Seattle"
}
],
"identities":[
{
"username":"john@contoso.com",
"roles":[ "sales" ],
"datasets":[ "cfafbeb1-8037-4d0c-896e-a46fb27ff229" ]
}
]
}
}
@rishikondap
Copy link

rishikondap commented Jun 2, 2020

Chris,
Thanks for posting this.
I am trying to export my Power BI report to PDF, using Powershell, and am able to do so for the default view. However, I need to apply filters dynamically and then export the report for each value. I created a bookmark, called "Test_Bookmark", but when I use that as the value for defaultBookmark, the script errors out. I assume I need to use the GUID like you are using. Where/how can I find that bookmark ID/GUID?
Thanks

@praveena459
Copy link

praveena459 commented Jul 6, 2020

Chris,
Thanks for posting this.
I am trying to export my Power BI report to PDF, using Powershell, and am able to do so for the default view. However, I need to apply filters dynamically and then export the report for each value. I created a bookmark, called "Test_Bookmark", but when I use that as the value for defaultBookmark, the script errors out. I assume I need to use the GUID like you are using. Where/how can I find that bookmark ID/GUID?
Thanks

were you able to find a solution

@lnogueracmnhospitals
Copy link

lnogueracmnhospitals commented Apr 9, 2021

The bookmark guid (which is more like a token instead) is basically the bookmark state. You can find the bookmark state using the javascript sdk like this:

report.bookmarksManager.capture().then(function (bookmark) { console.log(bookmark.state) });

@sbalasa
Copy link

sbalasa commented Mar 3, 2022

Thanks but we hit a 400 error when we pass dataset uuid's

{
  "error": {
    "code": "InvalidRequest",
    "message": "Creating embed token for accessing dataset 02ee066c-795d-4326-92ac-fc8470fe5fd2 shouldn't have effective identity"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment