Taxon only returns 30 out of >400 observations?

I am trying to access an API of all Fungi observations and display the medium_urls as images for each Fungus. However, although the API link returns > 400 records and medium_urls under each Fungus taxon, I can only display 30 through my GET requests. I tried setting the limit of the page in my code to 300 or another number without luck. How can I resolve this?

This is the API I am using: https://api.inaturalist.org/v1/observations?place_id=any&iconic_taxa=Fungi

Edit, I managed to get 200 with: https://api.inaturalist.org/v1/observations?place_id=any&iconic_taxa=Fungi&per_page=200, I am guessing this is the absolute limit or is there another way to get a bigger dataset?

1 Like

Welcome to the forum!
There are almost 8 million verifiable Fungus observations, you need the medium_url for every observation/image?
That’s considerably larger than the API was intended to support.

Can you explain more about what you’re intending to do with this data and we can try to suggest some alternatives?

(Also, this isn’t a bug, so I moved it out of the bug report category.)

4 Likes

You can use the page parameter to get more pages of results (e.g., page=2&per_page=200). See the Pagination section in the guide jwidness linked for more info.

If you want to get that many photos, though, you may want to get them from the iNaturalist Open Dataset instead.

2 Likes

A post was merged into an existing topic: Is there a tool / code snippet that allows downloading of taxonomy data from the site?

Thanks so much for the response! I won’t need all 8 million but I would like to access at least a couple of hundred pictures from the medium_url links in the API link (10k would be brilliant too). I thought I resolved it by using page & per_page parameters via https://api.inaturalist.org/v1/observations?place_id=any&iconic_taxa=Fungi&page=3&per_page=200 but after formatting the content on the page, I realised I was getting duplicates or more of each Fungus, so the real number did not actually decrease to 200 different observations. Is there another way of doing this successfully by changing the page & per_page parameters?

I would otherwise look into the bulk observation request method and read up on it - however, if I can easily change this via this method, that would be good to know!

You’re getting duplicate observations or duplicates of the same species? This search returns individual observations, so if there are multiple observations of the same species, you will get the same species multiple times.

Right, apologies. I thought the above API was linking only 1 observation for each Fungus! Either way, changing the page & per_page parameters, does not give more than 200 results (including duplicates / more). Is there any way at all to use your online API and get a list of each Fungi species (>200 records) with its according data - that does not list multiple of the same observations?

Have you looked at the taxa search documentation?

I have, I believe I sadly couldn’t figure out a route that would not include multiple of the same observations, that just accesses each species

What about something like https://api.inaturalist.org/v1/taxa?taxon_id=47170&rank=species?

It will return information for each species (up to 10k using paging), including the medium_url for the default taxon photo.

(Note that the default taxon photo won’t necessarily have an open license.)

Ah, I cannot believe I completely missed this - this works beautifully! Thank you so much! :blush:

Hey, thank you so much for your previous reply, that was a massive help. I noticed that https://api.inaturalist.org/v1/taxa/${id}, according to the API documentation, does not result in a single result of a single Fungus species either (avoiding multiple observations). Using(https://api.inaturalist.org/v1/taxa/150608152 e.g., I get an empty JSON array. I also tried to attach the id to the previous URL without luck. Any chance you can advise on that one too? Thanks again!

Sorry, I’m not sure what you’re trying to do. 150608152 isn’t a valid taxon id number on iNat – the highest number is around 1.5 million

So basically, I am trying access the api url of a single Fungus species by its correct id - instead of https://api.inaturalist.org/v1/observations?place_id=any&iconic_taxa=Fungi&page=3&per_page=200 - which returns all Fungi species.

(I got that id from https://www.inaturalist.org/observations/150608152.)

That is the observation number, not the taxon number. But if you go to that observation and click on the name at the top left corner, that will take you to the taxon page, and the url there will show you the taxon number.

1 Like

So is https://api.inaturalist.org/v1/taxa/60782 what you’re looking for?

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