Request Header required to retrieve items in BibTeX format

I would like to retrieve items from crossref.org in BibTeX format. I cannot find any instructions in the documentation, but a post on this forum by @ coelias on the thread
CrossRef bibtex export & improving it - #5 by mrittman
says that one can do so by setting the Accept header to “application/x-bibtex”. However, when I do that I get a “Not acceptable” response. The full headers I am setting, as reported in the response I get, are:
headers: array:3 [▼
“Host” => array:1 [▼
0 => “api.crossref.org
]
“User-Agent” => array:1 [▼
0 => “text2bib (https://text2bib.org); mailto:martin.j.osborne@gmail.com
]
“Accept” => array:1 [▼
0 => “application/x-bibtex”
]
]

Has something changed since the post by @coelias?

1 Like

Hello. Thanks for the question, I’ll take a look at the documentation and make sure this is clearer.

You need to add ‘transform’ to the end of the query URL, so it will look something like:

http://0-api-crossref-org.lib.rivier.edu/works/10.1142/S0217984919300011/transform

Using the headers you have above, this should work.

1 Like

Another option using curl:

curl -D - -L -H "Accept: text/x-bibtex" "https://0-doi-org.lib.rivier.edu/10.1126/science.1157784"
1 Like

That works — thank you. I can’t find any mention in the documentation at all about generating output in BibTeX format. If there is none, it would definitely be good to add some!

Yes, we’ll be adding a bibtex example soon. Thanks again for reporting this.

There are some accept headers (content negotiation) that work for Crossref, DataCite and mEDRA: DOI Content Negotiation

1 Like

Is it possible to obtain BibTeX output from a title/author query? Something like
https://0-api-crossref-org.lib.rivier.edu/works/transform?query.bibliographic="Toward a Unified Theory of High-Energy Metaphysics, Josiah Carberry 2008-08-13"
(with an accept header for application/x-bibtex). Or it is possible to retrieve BibTeX only from a doi? (I cannot find an answer in the documentation.)

Sorry for the long response time for this. You need to do the query.bibliographic query first then use content negotiation to get the bibtex format. These services are run on different databases so can’t be combined into one.

1 Like

Thanks for your response. To clarify what you mean: Suppose that I want to get the record that matches the title “Toward a Unified Theory of High-Energy Metaphysics” and author “Josiah Carberry” in BibTeX format. Are you saying that first I do
https://0-api-crossref-org.lib.rivier.edu/works?query.bibliographic=“Toward a Unified Theory of High-Energy Metaphysics, Josiah Carberry”
and then I extract the doi from the json that is returned and do a second query
https://0-api-crossref-org.lib.rivier.edu/works//transform
where is the doi from the first query?

Yes, that’s correct - you’ll need to make two different calls to the API.

1 Like