adsabs / adsabs-dev-api

Developer API service description and example client code
162 stars 58 forks source link

Issues with CSL export #89

Closed rjfarmer closed 1 year ago

rjfarmer commented 2 years ago

I'm trying to implement the CSL export option ( /export/csl) and are running into a few issues:

First the documentation (https://ui.adsabs.harvard.edu/help/api/api-docs.html#post-/export/csl) says you want "bibcodes" when its actually "bibcode" singular:

data = {
 "bibcodes": '2021ApJ...923..214F',
 "style": "aastex",
 "format": 1,
 "journalformat": 1,
  "sort": "first_author desc",
  }

Which gets the following response:

response={'error': 'no bibcode found in payload (parameter name is `bibcode`)'}

Even so, passing 'bibcode':

data = {
 "bibcode": '2021ApJ...923..214F',
 "style": "aastex",
 "format": 1,
 "journalformat": 1,
  "sort": "first_author desc",
  }

Gets a:

response={'error': 'no result from solr'}, status=404

On a whim I tried newline separating the bibcode (like a bigquery) and that gets somewhere:

data = {
 "bibcode": '2021ApJ...923..214F\n',
 "style": "aastex",
 "format": 1,
 "journalformat": 1,
  "sort": "first_author desc",
  }

But that returns a seemingly random result (though the same result independent of the bibcode I use)

response={'msg': 'Retrieved 1 abstracts, starting with number 1.', 'export': '\\bibitem[Khanna(2021)]{2021pte1.book.....K} Khanna, V. K.\\ 2021, Practical Terahertz Electronics: Devices and Applications, Volume 1, by Khanna, Vinod Kumar. ISBN: 978-0-7503-3169-2. IOP ebooks. Bristol, UK: IOP Publishing, 2021. doi:DOI:\n'}, status=200
rjfarmer commented 2 years ago

Okay i see the problem in the end, even though the you want a 'bibcode' singular you actually want a list of bibcodes. Could the documentation be made clearer? (or convert the api to use bibcodes (plural). export/custom has this as well (asking for bibcodes but it wants bibcode)

donnat commented 1 year ago

Hi Robert, I've fixed this bug in the API docs ("bibcodes" > "bibcode" where needed - it was in a few other spots than where you'd seen as well). I also updated the description text on that field to clarify that it can take one or more bibcodes. Thanks for pointing this out to us!

Kelly

On Sat, Aug 20, 2022 at 12:37 PM Robert Farmer @.***> wrote:

Okay i see the problem in the end, even though the you want a 'bibcode' singular you actually want a list of bibcodes. Could the documentation be made clearer? (or convert the api to use bibcodes (plural). export/custom has this as well (asking for bibcodes but it wants bibcode)

— Reply to this email directly, view it on GitHub https://github.com/adsabs/adsabs-dev-api/issues/89#issuecomment-1221363231, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABH5DPL3KZY4OTNV37EVBI3V2ECVXANCNFSM57DORS4A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

Dr. Kelly Lockhart Back-End Developer, NASA Astrophysics Data System Harvard-Smithsonian Center for Astrophysics 60 Garden Street, Cambridge, MA 02138