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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
jvembenil
Frequent Visitor

power bi rest api get all reports with endorsements

I finally got my powershell script working to call the Power BI rest methods to extract all workspaces and reports in workspaces.
But What I am missing is the the endorsement labels for each report. Does anyone know how I can modify this script get that info?

Any help would be appreicated.

 

# need to set this to ensure proper connections
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# import modules and login
Import-Module MicrosoftPowerBIMgmt
Import-Module MicrosoftPowerBIMgmt.Profile
Connect-PowerBIServiceAccount

# initialize variables
$uriGroups = 'https://api.powerbi.com/v1.0/myorg/groups'

Write-Host "******* Reading Workspaces *****"
try {
    $workSpacesJson = Invoke-PowerBIRestMethod -Url $uriGroups -Method Get
    $workspaceContents = $workSpacesJson | ConvertFrom-Json 
    $workspaceCount = $workspaceContents.value.count
    $workspaces = $workspaceContents.value 
    Write-Host "Total workspaces:" $workspaceCount

# loop thru the workspaces and get the reports
    foreach ($workspace in $workspaces) {
        $uriReports = $uriGroups + "/" + $workspace.id + "/reports?$expand=endorsementDetails"
        $reportsJson = Invoke-PowerBIRestMethod -Url $urireports -Method Get
        $reportsContents = $reportsJson | ConvertFrom-Json 
        $reportsCount = $reportsContents.value.count
        #$reports = $reportsContents.value 
        Write-Host "Total reports in workspace:" $reportsCount

        Write-Host "******* Exporting workspaces to json file *****"
        $ExportFile = "./export/Reports_"+$workspace.name+".json"
        $reportsJson | Out-File $ExportFile
    }
    if (-Not $?) {
    $errmsg = Resolve-PowerBIError -Last
    $errmsg.Message
    }
} catch {
    $errmsg = Resolve-PowerBIError -Last
    $errmsg.Message
}

Write-Host "******* Exporting workspaces to json file *****"
$ExportFile = "./export/WorkSpaces.json"
$workSpacesJson | Out-File $ExportFile

Disconnect-PowerBIServiceAccount
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

here's one of the ideas around that. Says "Needs Votes"  🙂

 

Microsoft Idea · Report Endorsement (powerbi.com)

 

View solution in original post

5 REPLIES 5
cbilsoe
Frequent Visitor

Picking up on an old topic, but since it is now possible to endorse both Dataset and Reports in the Power BI service can someone explain why this endorse information is not possible to retrieve via the Power BI Rest API???
 @v-shex-msft responded to another thread similar to this but it seems this has also been dropped Microsoft Idea (powerbi.com)

Boxmodern
Advocate IV
Advocate IV

It looks like the API documentation is still incorrect. EndorsementDetails are not returned by Get Report or Get Reports in Group.

lbendlin
Super User
Super User

here's one of the ideas around that. Says "Needs Votes"  🙂

 

Microsoft Idea · Report Endorsement (powerbi.com)

 

lbendlin
Super User
Super User

I think this is one of these rare cases where the documentation is ahead of the implementation.  I am sure the API team is working on updating that call's return structure.

Thanks for the input @lbendlin . Do you know if there is an idea out there for this or another location where I can post the request to the API team?

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.