Hi, I stumbled upon something strange in my application. One user is assigned to a lot of Okta groups. I am able to add this user to new groups in Administrator Dashboard.
When I call API endpoint /api/v1/groups/{groupId}/users I find all users assigned to my group, including said user. However when I call /api/v1/users/{userId}/groups this group is not present.
This problem occurs only for one particular user (one with a lot of groups).
Is there a limit of groups one user can be assigned to?
Hi @limak111 are stating that nothing comes back from your HTTP GET call to /api/v1/users/{userId}/groups
? Or the JSON payload did not list the group that this user is assigned to which sounds like pagination.
Thank you @noi.narisak for your response. I agree that this is probably a pagination issue. I wasn’t sure before
What ^ he said. Check the returned headers for ‘link’.
PS D:\scripts\OKTA-Powershell> $responseMe = Invoke-WebRequest -Method “GET” -uri $me -Headers $headers
PS D:\scripts\OKTA-Powershell> $responseme.Headers.link
When I do a lookup on myself there is no pagination…so no .link returned.
Here I am listing all users (so lots of pagination)
PS D:\scripts\OKTA-Powershell> $responseUsers = Invoke-WebRequest -Method “GET” -uri $allUsers -Headers $headers
PS D:\scripts\OKTA-Powershell> $responseUsers.Headers.link
https://kars4kids.okta.com/api/v1/users?limit=1; rel=“self”,https://kars4kids.okta.com/api/v1/users?after=000u174d5ukpjvZKV31d8&limit=1; rel=“next”
Now there is a ‘link’ returned. It is made up of 2 parts…One is the current url/pointer which is ‘self’ and the other one is the next set of users waiting to be returned. That’s the 'next one: after=000u174d5ukpjvZKV31d8. So if you pass in the ‘next’ link…you’ll get the next batch of groups/users/whatever
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.