"Accept" header in HTTP request for DOI Content Negotiation
It seems you are trying to profit from DOI Content Negotiation described here.
Content negotiation allows a user to request a particular representation of a web resource. DOI resolvers use content negotiation to provide different representations of metadata associated with DOIs.
A content negotiated request to a DOI resolver is much like a standard HTTP request, except server-driven negotiation will take place based on the list of acceptable content types a client provides.
Making a content negotiated request requires the use of a HTTP header, "Accept".
After @Kuba's comment this works
With[{url = URL["https://doi.org/10.1007/s00209-015-1612-7"]},
URLRead[
HTTPRequest[
url
, <|
"Method" -> "GET",
"Headers" -> {"Accept" -> "application/x-bibtex"}
|>
]
, "Body"
]
]
Other content formats defined by crosscite.org are:
{
"RDF XML" -> "application/rdf+xml",
"RDF Turtle" -> "text/turtle",
"Citeproc JSON " -> "application/vnd.citationstyles.csl+json",
"Schema.org in JSON-LD " -> "application/vnd.schemaorg.ld+json",
"Formatted text citation " -> "text/x-bibliography",
"RIS " -> "application/x-research-info-systems",
"BibTeX " -> "application/x-bibtex",
"CrossRef Unixref XML " -> "application/vnd.crossref.unixref+xml",
"DataCite XML " -> "application/vnd.datacite.datacite+xml",
"ONIX for DOI " -> "application/vnd.medra.onixdoi+xml"
}
I wasn't aware of that capability, so my first approach (A bit convoluted) was to parse the HTML of the journal website.
With[{url = URL["https://doi.org/10.1007/s00209-015-1612-7"]},
Import[
Echo@StringJoin[
"https:",
First@Select[
ImportString[
URLRead[HTTPRequest[url], "Body"]
, {"HTML", "Hyperlinks"}
], StringContainsQ[#, "format=bibtex"] &, 1]]
, "String"
]
]
This obviously will only work when the DOI link redirects to a journal website with a particular link structure. Notice that the BibTeX content is different.
request =
HTTPRequest[
URL["https://doi.org/10.1007/s00209-015-1612-7"], <|
"Method" -> "GET",
"Headers" -> {"Accept" -> "application/x-bibtex"},
"ContentType" -> "application/x-bibtex"|>];
URLRead[request, "Body"]
(*
@article{Blasiak_2016,
doi = {10.1007/s00209-015-1612-7},
url = {https://doi.org/10.1007%2Fs00209-015-1612-7},
year = 2016,
month = {jan},
publisher = {Springer Science and Business Media {LLC}},
volume = {283},
number = {1-2},
pages = {601--628},
author = {Jonah Blasiak},
title = {Haglund's conjecture on 3-column Macdonald polynomials},
journal = {Mathematische Zeitschrift}
}
*)
request =
HTTPRequest[
URL["https://doi.org/10.1090/s0002-9947-96-01558-9"], <|
"Method" -> "GET",
"Headers" -> {"Accept" -> "application/x-bibtex"},
"ContentType" -> "application/x-bibtex"|>];
URLRead[request, "Body"]
(*
@article{Fomin_1996,
doi = {10.1090/s0002-9947-96-01558-9},
url = {https://doi.org/10.1090%2Fs0002-9947-96-01558-9},
year = 1996,
month = {sep},
publisher = {American Mathematical Society ({AMS})},
volume = {348},
number = {09},
pages = {3591--3621},
author = {Sergey Fomin and Anatol N. Kirillov},
journal = {Transactions of the American Mathematical Society}
}
* )