I am retrieving data from Power BI Rest API following the instruction here: https://learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin#grouptype
A call to retrieve all data works ok. Here is the URL that works:
$url = "https://api.powerbi.com/v1.0/myorg/admin/groups?%24top="+$number_of_records+"&%24expand=dataflows,datasets,reports,dashboards,workbooks,users"
But this request return too much data that I want to filter it out.
In particular, I don't want to see personal workspaces. But my calls return an AggregateException error. Here are the URLs I tried that conform with the MSDocs but do not work:
Here I tried to filter out all "PersonalGroup" type
$url1 = "https://api.powerbi.com/v1.0/myorg/admin/groups?%24top=" + $number_of_records + '&%24filter=type ne' + " 'PersonalGroup'" + '&%24expand=dataflows,dashboards,reports,datasets,users'
And here I tried to keep everything except of "PersonalGroup" type
$url2 = "https://api.powerbi.com/v1.0/myorg/admin/groups?%24top=" + $number_of_records + '&%24filter=type eq' + " 'Group'" + ' or type eq' + " 'Personal'" + ' or type eq' + " 'Workspace'" + '&%24expand=dataflows,dashboards,reports,datasets,users'
Both throw the same error:
Invoke-PowerBIRestMethod : One or more errors occurred.
At line:1 char:15
+ $Result = Invoke-PowerBIRestMethod -Url $url -Method GET
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod
Does anyone know how is this fixable as I can't find an answer online and I don't see any errors in my request