Given a GBIF human readable webpage for a species, how to find the API call for each item on the page

If I visit this page: Baetis rhodani (Pictet, 1843)

There are many fields of data displayed. Is it possible to know the API call required for each item displayed on that page?

The https://www.gbif.org/species/4481106 page is human readable, and would have been ‘assembled’ by the web application software for gbif on its server to be displayed. That software would have made an API call for each item in that page, to be able to assemble the page to display in the browser.

To build on the above, what I would like is to have an API equivalent of the above URL - where I can query for each field seen on the human readable web page.

I see these 2 fields at the footer of the above species web page.

So the gbif web application server software would have done operations to display these.

It would be handy if the ‘machine name’ for each field on the human readable page could be displayed. The ‘machine name’ being the name of the field used in the example suggested API call.

Please let me know your thoughts.

Hi @therobyouknow

The data displayed on the species page can be access via:

  • the Occurrence API: GBIF occurrence API (occurrence count, links to the occurrences, gallery, “appear in occurrence datasets”)
  • the Species API: GBIF species API (species name, description, reference, vernacular names, “appear in checklists”)
  • the Maps API: GBIF maps API (map)
  • the Wiki data API: https://www.wikidata.org (taxon identifiers at the bottom of the page)

@mhoefft correct me if I am wrong/missed anything.

That covers most indeed. We also consult the IUCN API and CITES API as well as our own dataset API and publisher API. And in many cases one field will be a mixture of multiple API calls. E.g. we might get the dataset key (ID) from the species API, but then we consult the dataset API to get the dataset name.

@therobyouknow if you have questions about a specific part of the page, then I’m happy to help.

  • the Wiki data API: (taxon identifiers at the bottom of the page)

I would need to know more than that just that it is a call to wikidata - I need to know what actual specific parameter values to pass to wikidata for wikidata to return the specific taxon values shown in the footer/bottom of the page. For the gbif page where the above is displayed, i.e. Baetis rhodani (Pictet, 1843) what specific parameter values are passed in the call made to wikidata to display the taxon identifiers at the bottom of the page.

Going back to my original question: that gbif page has been assembled from data from API calls with parameters specific to 4481106, so I want to know what these parameter values are for the calls made to the APIs, for example wikidata. I want to know how, if I have 4481106 as a value in the URL page, then what value I need to pass to wikidata API to get NBN System Key : NHMSYS0000066962 or BOLD Systems taxon ID : 28746. Thank you,

Yes I do have a specifc question @mhoefft about part of that page, please see my last response above. Thank you.

I’m not a Wikidata expert, so questions related to Wikidata is probably better answered in another forum or at least by someone else than me, but perhaps this can help getting you started

https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fsubject%20WHERE%20{%20%3Fsubject%20wdt%3AP846%20'4481106'}

We do not manage GBIF identifiers on Wikidata. We just show the links claimed by Wikidata.

1 Like

GBIF would know enough to display the taxon ids at the foot of the page of gbif.org / species/4481106 i.e. - here:

This is wikidata displayed on a GBIF page. Therefore your site software for the GBIF website would have made calls to wikidata to fetch that taxon data from wikidata that is associated with the GBIF taxon ID of 4481106.

Sorry I’m not asking that anyone should be an expert. But I do know that there must be some knowledge of wikidata in GBIF so that the gbif website code was programmed by someone at gbif (an published on your github?) to make a call to wikidata to get the wikidata associated with GBIF taxon ID 4481106. This is a particular enquiry about how that wikidata taxon data is shown on the gbif website page, which has been implemented, so the know how is with GBIF, rather than asking for a general overall expert level of knowledge.

https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fsubject%20WHERE%20{%20%3Fsubject%20wdt%3AP846%20’4481106’}

Bang on the money @mhoefft - thank you very much - this helps a lot.

That is the example I provided above

https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fsubject%20WHERE%20{%20%3Fsubject%20wdt%3AP846%20'4481106'}

You need to query the wikidata sparql endpoint to get the entity ID and then get the entity afterwards and then process it to find the identifiers you are interested in. The example shows how to do a SPARQL query for all items that have a property of GBIF taxon ID (P846) with the desired value.

There are libraries that can simplify querying wikidata. Such as this one wikidata-sdk - npm

If you want the plain url then you need to do this with the appropriate query
https://query.wikidata.org/sparql?format=json&query=SELECT%20DISTINCT%20%3Fsubject%20WHERE%20{%20%3Fsubject%20wdt%3AP846%20'4481106'%20. %20%20%20%20%20}

and then fetch that query from the Wikidata API
e.g. https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q732867&format=json

Hope that helped

2 Likes

Thank you very much @mhoefft - I think that is sufficient to get me going. We can close this discussion. Most appreciated!

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