Getting the number of projects in a country is limited to 10,000

Hola :)

I have a function that uses the API to get the number of projects a country has on iNaturalist.

For instance, using this call for Uruguay: https://api.inaturalist.org/v1/projects?place_id=7259&page=1&per_page=1, I get the total_results value as 381. However, I noticed that for some countries, such as the US or Canada, this number is limited to 10,000 (see https://api.inaturalist.org/v1/projects?place_id=1&page=1&per_page=1).

Is there a way to get the total number despite this limit?

Any suggestions?

Thanks!

Flo

Get lists for states (plus DC) or provinces and merge them? Whether this works depends on whether a national or regional scale project shows up on an API call for a more local area.

Alternatively put in a feature request. The load on the server of an unrestricted request is probably less that the load on the server of you working round the restriction.

unfortunately, there’s not a good way to do this, as far as i know. although it’s possible to try to breakdown the big set into smaller sets via other parameters, it’s still likely that some subset is still going to be impossible to break down into a set smaller than 10000 in some cases. so that’s problematic at the end of the day.

this does sort of seem like a bug though (since most – but not all – of the API endpoints can return a count above 10000 in total_results). so maybe it’s something that could be addressed via a bug report? (or maybe at least iNat staff can comment on whether this existing behavior is intentional or not.)

Thanks to both. I agree, @pisum. It seems like a bug to me, too. I will report it.
Meanwhile, I decided to split my call by project type (collection, umbrella), then add them together.

here’s a feature request (which probably should have been a bug report) that i made back in the day for GET /taxa: https://forum.inaturalist.org/t/allow-taxon-search-api-endpoint-to-count-total-results-higher-than-10-000/9327. the last post in the thread links to the change made in GitHub. it looks like the change is relatively mnor.

this might work if you need only collection and umbrella projects, but i don’t think there’s a good way to segregate traditional projects. (i don’t think iNat ever explicitly gave traditional projects a type.)

I’m a software developer. Software bugs are different than software lacking certain features.

I looked at the iNaturalist API code, and id_below and id_above is not implemented for projects. Asking for a new feature is a feature request, not a bug report.

I would say the error message that is display for projects is a bug. “Result window is too large, page x size must be less than or equal to [10000]. Please narrow your search, or use a sliding window approach with id_above or id_below params.” That error message should not be shown for projects. That error message should only show up for API endpoints where id_above and id_below are implemented.

this has nothing to do with what shows up in the total_results field

This is great, @pisum and reflects exactly the same problem. Thanks a lot for your help!