Get metadata from DOI
Asked Answered
W

5

44

A digital object identifier (DOI) is a globally unique string that identifies an electronic document (for example, a PDF of an academic article). It essentially provides a method for creating a permalink to a document (for example, http://dx.doi.org/10.1145/146585.146609).

Is there a web service (or any other system) to get the metadata (preferably in BibTeX form) of a document from a given DOI?

Edited to add some expository information.

Whitworth answered 8/5, 2012 at 21:47 Comment(6)
I am not sure why this is closed either but there is information on this here crosscite.org/cnAcciaccatura
Since the question is closed, I will answer in the comments: curl -LH "Accept: text/bibliography; style=bibtex" http://dx.doi.org/10.1038/nrd842Undergird
Also, look for JabRef.Undergird
@Undergird Question's been reopened, if you want to convert your comment into an answer.Callow
You know you are on Stack Exchange when it takes two years to reopen a question.Theravada
note that you can also get JSON curl -LH "Accept: application/json" Fortuity
W
29

Section 5.4.1 Content Negotiation of the DOI Handbook documents states, "Content negotiation is being implemented by DOI Registration Agencies for their DOI names, specifically to offer value-added metadata representations for users." According to Section 4 Supported Content Types of the DOI Content Negotiation documentation for http://crosscite.org, "Currently three DOI registration agencies have implemented content negotation for their DOIs: CrossRef, DataCite and mEDRA." The list of supported formats (which depends on the registration agency) includes both BibTeX via Accept: application/x-bibtex (this is the approach used by http://doi2bib.org) and formatted bibliography entry via Accept: text/bibliography (this is the approach suggested by @anumi above). When using the latter header, you must specify the style=bibtex media type parameter.

The two relevant mimetypes provide slightly different representations. A request to GET http://dx.doi.org/10.1038/nrd842 with Accept: application/x-bibtex yields the response

@article{Atkins_2002,
    doi = {10.1038/nrd842},
    url = {http://dx.doi.org/10.1038/nrd842},
    year = 2002,
    month = {jul},
    publisher = {Springer Nature},
    volume = {1},
    number = {7},
    pages = {491--492},
    author = {Joshua H. Atkins and Leland J. Gershell},
    title = {From the analyst{\textquotesingle}s couch: Selective anticancer drugs},
    journal = {Nature Reviews Drug Discovery}
}

and with Accept: text/bibliography; style=bibtex

@article{Atkins_2002, title={From the analyst’s couch: Selective anticancer drugs}, volume={1}, ISSN={1474-1784}, url={http://dx.doi.org/10.1038/nrd842}, DOI={10.1038/nrd842}, number={7}, journal={Nature Reviews Drug Discovery}, publisher={Springer Nature}, author={Atkins, Joshua H. and Gershell, Leland J.}, year={2002}, month={Jul}, pages={491–492}}
Whitworth answered 28/10, 2016 at 18:22 Comment(1)
Great job putting this together! I would mark it as an answer, it's really helpful.Vocation
U
16

curl -LH "Accept: text/bibliography; style=bibtex" http://dx.doi.org/10.1038/nrd842

Undergird answered 10/12, 2015 at 13:11 Comment(4)
There is also doi2bib ("give us a DOI and we'll do our best to get you the BibTeX entry") at doi2bib.org/#/doiUndergird
Is this request/response interface documented somewhere? How did you find this functionality?Whitworth
@argentpepper: sorry, I don't remember.Undergird
@argentpepper: Apparently it's official: crossref.org/labs/citation-formatting-serviceRemittee
V
6

Take a look at how these guys implemented it: www.doi2bib.org.

What I did in one of my projects:

  • looked at their url request structure: http://www.doi2bib.org/doi2bib + ?id= + {your doi here}.
  • then used their... well API to get the data (e.g. http://www.doi2bib.org/doi2bib?id=10.1016%2Fj.actpsy.2016.09.007) and the response is:
    • @article{Leinen_2016, doi = {10.1016/j.actpsy.2016.09.007}, url = {http://dx.doi.org/10.1016/j.actpsy.2016.09.007}, year = 2016, month = {nov}, publisher = {Elsevier {BV}}, volume = {171}, pages = {36--46}, author = {Peter Leinen and Stefan Panzer and Charles H. Shea}, title = {Hemispheric asymmetries of a motor memory in a recognition test after learning a movement sequence}, journal = {Acta Psychologica} }
  • then you can parse it the way you want.

This helped me to get what I needed done. However, the nicest way would be to take a look at their GitHub repository and try to build your own.

Hope it helps!

Vocation answered 28/10, 2016 at 6:51 Comment(2)
Thanks! Their application seems to be making a request like that of @Undergird above (GET http://dx.doi.org/whatever) but with the header Accept: application/x-bibtex; charset=utf-8 instead of Accept: text/bibliography; style=bibtex. I will create a new answer with this info.Whitworth
Doing something like `curl "doi2bib.org/doi2bib?id=<DOI>" doesn't work. What command did you use to get the output?Pentlandite
T
4

CrossRef has an API, which you can use with an API key that can be obtained free of charge from http://www.crossref.org/requestaccount/.

Theravada answered 24/6, 2016 at 0:52 Comment(2)
No longer available.Hulbig
@Hulbig You don't have to register anymore. The API still works.Rozier
F
2

Python implementation:

import requests

def get_doi_bibtex(doi):
  base_url = f"https://doi.org/{doi}"
  headers = {
      "Accept": "text/bibliography; style=bibtex"
  }
  response = requests.get(base_url, headers=headers)

  if response.status_code == 200:
    return response.text.strip()
  else:
    print(response.status_code)
    print(response.text)
    return None

get_doi_bibtex("10.1109/xxxx")
Feldt answered 4/5, 2023 at 16:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.