Auth0 Home Blog Docs

How per_page & page works for Get Group Members API

Hi Team,

I am having a total of 28 users assigned to a particular group, say users range from A1-A28.
To fetch users . to a particular group I am using below auth0 API
GET /groups/{group_id}/members API as shown in auth0 documentation

& I am fetching them using per_page & page argument as max 25 users are returning by Auth0 API.
So I am calling Auth0 API 2 times to get 25 users in one API response & remaining 3 in the 2nd API response.

groups/GROUP_ID/members?per_page=25&page=0
which return A1-A25 Users. (Which is as expected)

For fetching remaining 3, I am using
groups/GROUP_ID/members?per_page=3&page=1
I am expecting it will give me
A26-A28.

But instead, it’s giving me users
A-22 to A25.

Could you please help me I am doing something wrong here?
Why it’s not returning pending 3 users A26-A-28?

Thanks & Regards,
Ashish Bainade

Hey @ashish.bainade, after checking with one of our senior engineers you should leverage the same command of per_page=25&page=2. Otherwise it’ll list 3 to per page along with taking the second page out of the mix. Please let me know if this helps you in your quest. Thanks!

It created a small confusion can you sort it for me pls?

I have 28 users so users are present across 2 pages.
The pages would be 0,1 or 1,2?

The two API would be

groups/GROUP_ID/members?per_page=25&page=0
groups/GROUP_ID/members?per_page=25&page=1

OR

groups/GROUP_ID/members?per_page=25&page=1
groups/GROUP_ID/members?per_page=25&page=2

Could you please clear my confusion here?

Thanks & Regards,
Ashish Bainade

After reaffirming with our senior engineer this is the way to go. I hope this clears up any confusion. Thanks!

1 Like

Thank you so much for help.
for me below worked:
groups/GROUP_ID/members?per_page=25&page=1
groups/GROUP_ID/members?per_page=25&page=2

thanks a lot for the support. I must say auth0 community is very active & always there for the support.

1 Like

Thank you for the positive feedback @ashish.bainade!

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