This notebook queries the Crossref API via its '/works'
endpoint for works authored by a person. It takes an ORCID URL or ORCID iD as input which is used to filter for all works where one of the authors' orcid
field matches the given ORCID iD.
From the resulting list of works we output all DOIs.
# Prerequisites:
import requests # dependency to make HTTP calls
from habanero import Crossref # lib for querying crossref api
The input for this notebook is an ORCID URL or ORCID iD, e.g. 'https://orcid.org/0000-0003-2499-7741
' or '0000-0003-2499-7741
'
# input parameter
example_orcid="https://orcid.org/0000-0003-2499-7741"
We use it to query the Crossref API via its '/works
' endpoint and set a filter for the orcid
field to match the given ORCID iD.
# we are using an existing library for querying the api crossref
orcid_id= example_orcid.replace("https://orcid.org/", "")
list_of_pages=Crossref().works(filter = {'orcid': orcid_id}, cursor = "*", select = "DOI,title")
Since the Crossref API uses pagination, we need to loop through all pages to get the complete result set. We print out title and DOI of each work in the result set.
#-- example execution
for page in list_of_pages:
for item in page['message']['items']:
print(f"{item['DOI']}, {item['title'][0]}")
10.3897/rio.7.e66264, OPTIMETA – Strengthening the Open Access publishing system through open citations and spatiotemporal metadata 10.31263/voebm.v72i2.2808, Open Science und die Bibliothek – Aktionsfelder und Berufsbild 10.1080/19386389.2021.1999156, Roadmap to FAIR Research Information in Open Infrastructures 10.21105/joss.01182, VIVO: a system for research discovery 10.3897/rio.4.e31656, Reference implementation for open scientometric indicators (ROSI)