Using this template helps us debug your issues more effectively
Description
It appears that removing members from a group while enumerating results from subsequent GET /groups/{groupId}/members calls using the next_page_token parameter results in only getting every other page. Is this correct?
Error
Getting only 1/2 the pages from GET /groups/{groupId}/members.
Which App Type (OAuth / Chatbot / JWT / Webhook)?
JWT
Which Endpoint/s?
/groups/{groupId}/members
How To Reproduce (If applicable)
Steps to reproduce the behavior:
Call GET /groups/{groupId}/members
Call DELETE /groups/{groupId}/members/{memberId} for each member returned in previous step (1 or 3).
Call GET /groups/{groupId}/members?next_page_token={whatever was last returned from such a call}.
Return to step 2 until there are no more pages returned.
Observe that approximately half of the users are still in the group (give or take 30 or 60).
Wonder whether removing members from the group while enumerating them is causing every other page of results to be skipped.
We see what the issue is here. What’s happening is that when you delete the members from one page, the update affects the subsequent page results you’re trying to query for.
In order to remedy this, use the “page_size” query parameter to increase the page size to get all the members you’re looking to delete.
Thanks Gianni. Yes, that’s what I figured was happening.
I got the job done by repeatedly running my process, deleting 1/2 at a time, until I got down to 60 and it deleted them all.
There were over 46,000 accounts to delete, and I wanted to do it incrementally rather than getting the whole list at once, then looping through with delete calls.
Getting a new page 1 until there isn’t one didn’t occur to me, I like that approach. I’ll keep that in mind for my next big change!