I was looking at crows here, with id 2482468, but when I tried finding its media here: https://api.gbif.org/v1/species/2482468/media, I get a blank response, even though it is supposed to have thousands of images. Can anyone please guide me on what I am doing wrong?
Hi @DonBoscow
What you see on the GBIF website are the images for occurrences associated for this species (Search). So you would need to use the occurrence API to access the URLs to those images. For example: https://api.gbif.org/v1/occurrence/search?media_type=StillImage&taxon_key=2482468
See this related thread and additional explanations here: Missing species media in API? - #2 by mgrosjean
Perfect, thanks a lot!
By the way, what does this URL signify?
Images and media can be shared in a checklist like here: Tubuliporina. Those are associated with the taxon itself and directly from a checklist (they often refer to the original publication describing the species). These can be accessed with the species API like https://api.gbif.org/v1/species/148403721/media.
If you want to learn more on non-occurrence species information, I suggest checking our recorded webinar here: Data Use Club - practical session 5 - recording and resources
I hope it helps!
Got it. I am not particularly interested in checklist media, I am looking for just all media available for a given species. So if I use this API like you suggested earlier, I should be getting all media (with pagination), correct?
That is correct but only up to a 100,000 records (so not all of them).
I would strongly recommend using the download API see also: API Downloads :: Technical Documentation or generating a download with the web interface as the number of records won’t be limited and it will give you a citable DOI (citing the DOI will allow us to credit the data providers whose data contributed to your work). See our Citation guidelines
Note that image licenses aren’t always open. Please check that the license of the images before using them and don’t forget to cite them.
Umm yes, the occurrence API is what I was refering to, that is the samw API you had posted as the first response to my question, right? If I keep trying this API with incremental offsets, won’t I be able to cover all images, or will the 100k limit apply here as well:
search?media_type=StillImage&taxon_key=2482468&offset=0&limit=200?
P.S. Which species has more than 100,000 images here?
You won’t be able to get all the images with the occurrence search API, the 100k limit corresponds to the total amount of records queried. So the example I sent (https://api.gbif.org/v1/occurrence/search?media_type=StillImage&taxon_key=2482468), won’t work for any species.
The genus Corvus, for example has 479,808 occurrence records associated with images. I recommend using the download API for this (where the number of records isn’t limited).
Our blog (GBIF · GBIF Data Blog) has several articles containing examples of download APIs. See this one: Downloading occurrences from a long list of species in R and Python - GBIF Data Blog for example.
I hope this helps.
Wow. This is complicated! So, in order to get all 479,808 images for Corvus, do I need to make one giant bulk request for all images? Or can we do this only in instalments? If so, the code you referred to does not show us how to specify which set of the 479k images we want for our current download call.
A good place to get started would be to use the web interface: Search. Click on the download tab and choose the download format “DWCA” (see the specification of the format here: FAQ).
On the download page, you will be able to see JSON query that was made to generate the download. You will be able to copy/paste and modify that query for your own needs.
Note that the download won’t contain any image. Only image URLs (you should check that the image are fit for use and have the license that allow such use before downloading and using the images based on the URLs provided).
You are welcome to make any sub-selection of records, for example, you can select the Corvus occurrences based on their continent.
Does it make sense?
Perhaps this video introduction to our API would be helpful? Data use club - practical session 3 - recording and resources
I know I am being really slow, so apologies in advance, but what is preventing me from adding the list of all species (I guess there are hundreds of thousands of species in GBIF data) in this “values” variable, and just get the list of all images for all those species (I imagine the list will run into millions) in one giant download request (even if it takes days to appear in my downloads page)? The response will contain all those image links, which I can download at will then, right?
For example, I was playing with a download link for anaconda here. It says there are some 1006 images in the gallery, but the downloaded TSV file has 2878 rows. The occurrence ids are weird:
If you want to select only records associated with images, you need to specify it in the “media type” filter. For example: Search. The occurenceIDs are provided by individual data providers so they can be quite heterogeneous.
About your other question: you are very welcome to query up to a 100,000 scientific names in one download (the download should take less than 3 h to generate). But perhaps a more efficient way to query would be to select a higher taxon. For example, all the birds with images: Search. The query is must simpler, the download would be big but wouldn’t take long to generate.
I hope it helps.
Ok, this looks severely cool. So if I just use this: download?media_type=StillImage&taxon_key=1, and download the massive Darwin Core Archive, it will contain all records with image URLs for Animalia, which I can download at will, correct? This way, if we do it 20-30 times for all top level taxa like Animalia, etc., that should effectively give us all image URLs for download, is that right?
Hi @DonBoscow yes but you can also get everything in one download if you prefer like this: Search. Note that the estimated download file would be 374 GB.
Wow. That’s wicked cool. Thanks a lot! You have been very kind!