API /projects/{id}/members doesn't list all members

,

When I try to get all members of a project which has more than per_page members, some of members are repeated on different pages of json. For example, if I set per_page=1, I get the same user at second and third pages.

Platform (Android, iOS, Website):
API

URLs (aka web addresses) of any relevant observations or pages:

Screenshots of what you are seeing (instructions for taking a screenshot on computers and mobile devices: https://www.take-a-screenshot.org/):

Description of problem (please provide a set of steps we can use to replicate the issue, and make as many as you need.):

Step 1:
Go to
https://api.inaturalist.org/v1/docs/#!/Projects/get_projects_id_members
Fill the form with values:

key value
id flora-of-russia
page 2
per_page 1

https://api.inaturalist.org/v1/projects/flora-of-russia/members?page=2&per_page=1

Step 2:
Look to the user in result (id": 830550,“login”: “woodmen19”)

Step 3:
Change page to 3

https://api.inaturalist.org/v1/projects/flora-of-russia/members?page=3&per_page=1

Step 4:
Look to the user in result (id": 830550,“login”: “woodmen19”). It shouldn’t be the same as the second page.

it doesn’t seem like the results returned by the endpoint are ordered in any logical way. if they’re not consistently ordered, then maybe that explains why a given member might show up on different pages of results for no good reason?

I also encountered this bug the other day, and found a workaround:
Add &order_by=login to the end of the query.
This will order by user member login names rather than by observation count, which is the default order, and seems to solve the problem of missing users.

I found this by looking at the code here.

My guess at the reason behind the behaviour is where one page ends and another starts, if there’s users with the same number of observations, it’s possible to receive the same user at the start of one page, and the end of another, which effectively hides the user that should have been returned instead.

4 Likes

Awesome, it works now, thank you!

It seems so.

2 Likes

just for easy reference, i believe the “it” is this:

Yes, you are right)