Is there a zbib API that returns BibTeX entry string?

Hello,

Is there a zoterobib/zbib API that can return a BibTeX entry string?

At present, I can paste a URL in the field on https://zbib.org/, and have it return a Bibliography formatted as per the selected citation style.

Instead I need these:

1. Raw BibTeX entry.. I later generate the Bibliography using Pandoc.
2. Need to fetch the BibTeX entry from command line. So I cannot manually visit the site and paste the URL. Is there an API that I can use that returns the BibTeX entry in a JSON object?

Thanks.

PS: I cannot install Zotero on my machine. It is RHEL 6.8 which has only GTK2. The available downloads work only on Linux systems with GTK3. So I am relying on zbib.org.
  • edited September 19, 2018
    Check out the Citoid API (which relies on Zotero translators, albeit often slightly out of date ones under the hood): https://www.mediawiki.org/wiki/Citoid/API

    I don't believe the Zotero translation API used in zbib is currently exposed, but I could be wrong.
  • edited September 20, 2018
    No need to use Citoid. You can just run an instance of our translation-server (which powers both ZoteroBib and Citoid):

    https://github.com/zotero/translation-server

    You can easily write a script for that that will let you get BibTeX from a given URL from the command line — you'd basically just combine the translate_url and translate_export example scripts there.
  • right, but that requires you to install & run the translation server, or am I misunderstanding what you're suggesting? Citoid exposes a public API that returns bibtex.
  • Well, this is v2, so there's really not much to that — assuming a current version of Node, it's just npm i and npm start.

    (Technically the server part isn't even necessary and the translation code could be run just via a script. There's an example of that here, though that's only for the web translation part, not the BibTeX part.)

    Citoid may be fine — we (as in Zotero) just can't vouch for it. I know they're in the process of updating it to use translation-server-v2, but right now it may still be using an ancient version of the server, and the translators are almost certainly older. I think it also may use some of its own logic for some things that translation-server handles natively. Just to pick a random example, I get much better metadata for the current top article on the NYT homepage from a local translation-server than from their public API.
  • Hi, I've just checked out the translation-server. It's really cool, thank you for making it available! I'm just wondering - how does zotero grab metadata from pdfs that are imported into the library? I'd like to be able to run a local instance of the translation-server that watches a directory I have, and then periodically creates a .bib file containing the references to all the pdfs in the dir, as well as renaming them to the format that zotero does (e.g. 12345.678.pdf -> Some, Author - 2019 - Title of work.pdf). Is this possible to do without too much wrangling?
  • @harritaylor: Not really, no. PDF functionality isn't currently part of translation-server, and even when it is, it's not likely to be something we consider supported public functionality. You'd be better off doing that via Zotero itself with a combination of plugins: ZotFile to add files on-demand from a given directory (though I'm not sure it can add them as standalone attachments so that Zotero will run metadata retrieval on them, so it may not help) and more flexible renaming and Better BibTeX to automatically maintain an external BibTeX file.
  • @dstillman thanks for the quick reply! Okay, that makes sense. Thanks for the recommendations, I'll see what I can do.
Sign In or Register to comment.