Skip to content

Added table of contents endpoint to list all export endpoints and their types#277

Merged
kelockhart merged 3 commits intoadsabs:masterfrom
kelockhart:toc
Jun 3, 2025
Merged

Added table of contents endpoint to list all export endpoints and their types#277
kelockhart merged 3 commits intoadsabs:masterfrom
kelockhart:toc

Conversation

@kelockhart
Copy link
Member

Endpoint: GET /toc
Return: {'BibTeX': {'type': 'tagged'}, ...
Types are: ['tagged', 'LaTeX', 'XML', 'text', 'custom']

@coveralls
Copy link

coveralls commented May 23, 2025

Coverage Status

coverage: 97.125% (+0.04%) from 97.09%
when pulling 050cf3c on kelockhart:toc
into 64bdb48 on adsabs:master.

@kelockhart
Copy link
Member Author

@thostetler Check the output format:
{'BibTeX': {'type': 'tagged'}, 'BibTeX ABS': {'type': 'tagged'}, 'ADS': {'type': 'tagged'}, 'EndNote': {'type': 'tagged'}, 'ProCite': {'type': 'tagged'}, 'RIS': {'type': 'tagged'}, 'RefWorks': {'type': 'tagged'}, 'MEDLARS': {'type': 'tagged'}, 'DC-XML': {'type': 'XML'}, 'REF-XML': {'type': 'XML'}, 'REFABS-XML': {'type': 'XML'}, 'JATS-XML': {'type': 'XML'}, 'AASTeX': {'type': 'LaTeX'}, 'Icarus': {'type': 'LaTeX'}, 'MNRAS': {'type': 'LaTeX'}, 'Solar Physics': {'type': 'LaTeX'}, 'ASPC': {'type': 'LaTeX'}, 'ASP Conference': {'type': 'LaTeX'}, 'AAS Journals': {'type': 'LaTeX'}, 'APS Journals': {'type': 'text'}, 'IEEE': {'type': 'text'}, 'AGU': {'type': 'text'}, 'GSA': {'type': 'text'}, 'AMS (Meteorological)': {'type': 'text'}, 'CSL': {'type': 'custom'}, 'custom': {'type': 'custom'}, 'VOTable': {'type': 'XML'}, 'RSS': {'type': 'XML'}}

This is meant to allow the UI to update the list of available export endpoints so new endpoint won't need to be added by hand. I've also added "types", which are currently manually recorded in the export service README. This will provide more info to users, plus will make it easier to expose the text type export options on the abstract page. Let me know if this format will work on the UI side, or if edits are needed.

Copy link

@tjacovich tjacovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on the technical side. I'll let @thostetler weigh in on if it works for the front end.

Copy link
Member

@thostetler thostetler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dict-style format is okay, especially if you foresee this being useful for some other service, but for the front-end we might need some more information.

  1. A list would be more immediately digestible, since I could pull it directly in without the extra transform step a JavaScript object creates.

  2. We still have to do a mapping to the actual endpoints these hit, so it would mean some hard-coding. To help with that I would suggest adding the endpoint route to the entry.
    i.e. "path" or "route" or similar

[
  ...,
  { "format": "BibTeX", "type": "tagged", "path": "bibtex" }
]
  1. Any other information, like a description would also be great, but not a must-have.

Also, to disambiguate a little on the ones with multiple routes -- On the front-end we only do POSTs to the export service, so the other GET endpoints can just get ignored. Or we could add a method param to the entries.

This does make this whole thing a little more complicated however, so please let me know if you think this is a smart way to go, especially for a list that doesn't change frequently.

Anyway, I think this is great idea, we should try to provide more manifest endpoints like this, it would make updating things easier.

@kelockhart
Copy link
Member Author

@thostetler I've updated the output format - it's now a list of dictionaries, plus the route is included. There's no duplication for the get/post options, just one deduplicated listing for each route. Here's the current output:
[{'name': 'BibTeX', 'type': 'tagged', 'route': '/bibtex'}, {'name': 'BibTeX ABS', 'type': 'tagged', 'route': '/bibtexabs'}, {'name': 'ADS', 'type': 'tagged', 'route': '/ads'}, {'name': 'EndNote', 'type': 'tagged', 'route': '/endnote'}, {'name': 'ProCite', 'type': 'tagged', 'route': '/procite'}, {'name': 'RIS', 'type': 'tagged', 'route': '/ris'}, {'name': 'RefWorks', 'type': 'tagged', 'route': '/refworks'}, {'name': 'MEDLARS', 'type': 'tagged', 'route': '/medlars'}, {'name': 'DC-XML', 'type': 'XML', 'route': '/dcxml'}, {'name': 'REF-XML', 'type': 'XML', 'route': '/refxml'}, {'name': 'REFABS-XML', 'type': 'XML', 'route': '/refabsxml'}, {'name': 'JATS-XML', 'type': 'XML', 'route': '/jatsxml'}, {'name': 'AASTeX', 'type': 'LaTeX', 'route': '/aastex'}, {'name': 'AASTeX (PSJ)', 'type': 'LaTeX', 'route': '/aastex-psj'}, {'name': 'Icarus', 'type': 'LaTeX', 'route': '/icarus'}, {'name': 'MNRAS', 'type': 'LaTeX', 'route': '/mnras'}, {'name': 'Solar Physics', 'type': 'LaTeX', 'route': '/soph'}, {'name': 'ASPC', 'type': 'LaTeX', 'route': '/aspc'}, {'name': 'ASP Conference', 'type': 'LaTeX', 'route': '/aspc/<bibcode>'}, {'name': 'AAS Journals', 'type': 'LaTeX', 'route': '/aasj'}, {'name': 'APS Journals', 'type': 'text', 'route': '/apsj'}, {'name': 'IEEE', 'type': 'text', 'route': '/ieee'}, {'name': 'AGU', 'type': 'text', 'route': '/agu'}, {'name': 'GSA', 'type': 'text', 'route': '/gsa'}, {'name': 'AMS (Meteorological)', 'type': 'text', 'route': '/ams'}, {'name': 'CSL', 'type': 'custom', 'route': '/csl'}, {'name': 'custom', 'type': 'custom', 'route': '/custom'}, {'name': 'VOTable', 'type': 'XML', 'route': '/votable'}, {'name': 'RSS', 'type': 'XML', 'route': '/rss'}]

@kelockhart
Copy link
Member Author

@tjacovich you may want to take another look, if you have a minute - I've changed the logic a bit here.

@thostetler
Copy link
Member

These changes look good to me. Thanks @kelockhart!

Copy link

@tjacovich tjacovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on my end as well.

@kelockhart kelockhart merged commit 83521f8 into adsabs:master Jun 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants