List Group Members negatively affected by removing from group?

Using this template helps us debug your issues more effectively :slight_smile:

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:

  1. Call GET /groups/{groupId}/members
  2. Call DELETE /groups/{groupId}/members/{memberId} for each member returned in previous step (1 or 3).
  3. Call GET /groups/{groupId}/members?next_page_token={whatever was last returned from such a call}.
  4. Return to step 2 until there are no more pages returned.
  5. Observe that approximately half of the users are still in the group (give or take 30 or 60).
  6. Wonder whether removing members from the group while enumerating them is causing every other page of results to be skipped.

Hi @charlene.wright ,

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.

Alternatively, you can do what you’re currently doing minus the “next_page_token” to grab the new first page results and delete.

Let me know how this works out.

Best,
Gianni

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. :slight_smile: I’ll keep that in mind for my next big change!

Hi @charlene.wright,

So happy to hear it! Thanks again for your inquiry.

Gianni

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.