Forum Discussion
API - Admin - Groups GetGroupsAsAdmin - can't get it to work
- 1 year ago
run a second call
$topn="%24top=5000"
$skip="%24skip=5000"
$Url = "https://api.powerbi.com/v1.0/myorg/admin/groups?$topn&$skip"
this works for 5000. How to get the others is the questions.
CODE.
$authResult = Invoke-WebRequest -Uri $authUrl -Method POST -Body $body
$accessToken = ($authResult.Content | ConvertFrom-Json).access_token
# Call the Power BI REST API to retrieve a list of dataflows
$topn="%24top=5000"
$Url = "https://api.powerbi.com/v1.0/myorg/admin/groups?$topn"
$headers = @{
Authorization = "Bearer $accessToken"
}
$response = Invoke-RestMethod -Uri $Url -Method get -Headers $headers
$completeListOfActivityEvents = @()
$completeListOfActivityEvents += $response.value
$continuationToken = $response.continuationToken
$continuationUri = $response.continuationUri
while ($ContinuationToken -ne $null)
{
$response = Invoke-RestMethod -Uri $continuationUri -Method get -Headers $headers
$continuationUri = $response.continuationUri
$continuationToken = $response.continuationToken
$completeListOfActivityEvents += $response.value
}
END CODE
run a second call
$topn="%24top=5000"
$skip="%24skip=5000"
$Url = "https://api.powerbi.com/v1.0/myorg/admin/groups?$topn&$skip"
- DerekLedbetter1 year agoFrequent Visitor
Thanks for the assist.
I was able to get all the workspaces by performing two calls.