post results preserve order of input bibcodes (feature request?)
Opened this issue · 0 comments
Hi, when I make a post request by bibcodes, is it possible to return a list of results with an item (the BibTeX entries) for each input bibcode, preserving order?
Looking at the documentation, a post request returns a single string containing all found BibTeX entries regardless of the number of input bibcodes. These can be sorted by fields, but not by the input order. Thus, there are cases when one cannot easily find the corresponding BibTeX for each input bibcode (e.g., a multiple-bibcode request, providing alternate bibcodes, see MWE below).
Sorting by bibcode does not help, since the order can change if one provides an alternate_bibcode that turns into a bibcode.
Splitting the request into a series of single-bibcode posts does not seem like a good option, since it loses the advantage of requesting all bibcodes at once, and consumes the daily requests.
I could potentially do a cross-check (between input bibcodes and result BibTeX entries), but I think this is below optimal as well, since I'm not sure one can cover all cases (arxiv format have changed over time, and I don't know whether there are other alternate_bibcode cases beside arXiv).
Thanks for all your work putting up this API!
MWE:
import requests
import json
my_token = 'my_token_here'
r = requests.post("https://api.adsabs.harvard.edu/v1/export/bibtex",
headers={"Authorization": f'Bearer {my_token}',
"Content-type": "application/json"},
data=json.dumps({"bibcode":['2010arXiv1007.0324B', '2017arXiv170908635K']}))
print(r.json()["export"])
@ARTICLE{2018ApJ...858L...6K,
author = {{Kreidberg}, Laura and {Line}, Michael R. and {Thorngren}, Daniel and
{Morley}, Caroline V. and {Stevenson}, Kevin B.},
title = "{Water, High-altitude Condensates, and Possible Methane Depletion in the Atmosphere of the Warm Super-Neptune WASP-107b}",
journal = {\apj},
keywords = {planets and satellites: atmospheres, planets and satellites: composition, planets and satellites: individual: WASP-107b, Astrophysics - Earth and Planetary Astrophysics},
year = 2018,
month = May,
volume = {858},
eid = {L6},
pages = {L6},
doi = {10.3847/2041-8213/aabfce},
archivePrefix = {arXiv},
eprint = {1709.08635},
primaryClass = {astro-ph.EP},
adsurl = {https://ui.adsabs.harvard.edu/\#abs/2018ApJ...858L...6K},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
@ARTICLE{2011ApJ...731...16B,
author = {{Beaulieu}, J. -P. and {Tinetti}, G. and {Kipping}, D.~M. and {Ribas},
I. and {Barber}, R.~J. and {Cho}, J.~Y. -K. and {Polichtchouk},
I. and {Tennyson}, J. and {Yurchenko}, S.~N. and {Griffith},
C.~A. and {Batista}, V. and {Waldmann}, I. and {Miller}, S. and
{Carey}, S. and {Mousis}, O. and {Fossey}, S.~J. and {Aylward},
A.},
title = "{Methane in the Atmosphere of the Transiting Hot Neptune GJ436B?}",
journal = {\apj},
keywords = {planetary systems, techniques: spectroscopic, Astrophysics - Earth and Planetary Astrophysics},
year = 2011,
month = Apr,
volume = {731},
eid = {16},
pages = {16},
doi = {10.1088/0004-637X/731/1/16},
archivePrefix = {arXiv},
eprint = {1007.0324},
primaryClass = {astro-ph.EP},
adsurl = {https://ui.adsabs.harvard.edu/\#abs/2011ApJ...731...16B},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}