JSON-RPC

You can call into BBT using JSON-RPC on the URL http://localhost:23119/better-bibtex/json-rpc . An example could look like:

curl http://localhost:23119/better-bibtex/json-rpc -X POST -H "Content-Type: application/json" -H "Accept: application/json" --data-binary '{"jsonrpc": "2.0", "method": "collection.scanAUX", "params": ["/My Library/thesis/article1", "/Users/phantom/Downloads/output.aux"] }'

The available methods are:

autoexport.add(collection, translator, path, displayOptions, replace)

Add an auto-export for the given collection. The target collection will be created if it does not exist

  • collection: The forward-slash separated path to the collection. The first part of the path must be the library name, or empty (//); empty is your personal library. Intermediate collections that do not exist will be created as needed.
  • translator: The name or GUID of a BBT translator
  • path: The absolute path to which the collection will be auto-exported
  • displayOptions: Options which you would be able to select during an interactive export; exportNotes, default false, and useJournalAbbreviation, default false
  • replace: Replace the auto-export if it exists, default false

returns: Collection ID of the target collection

collection.scanAUX(collection, aux)

Scan an AUX file for citekeys and populate a Zotero collection from them. The target collection will be cleared if it exists.

  • collection: The forward-slash separated path to the collection. The first part of the path must be the library name, or empty (//); empty is your personal library. Intermediate collections that do not exist will be created as needed.
  • aux: The absolute path to the AUX file on disk

item.attachments(citekey)

List attachments for an item with the given citekey

  • citekey: The citekey to search for

item.bibliography(citekeys, format)

Generate a bibliography for the given citekeys

  • citekeys: An array of citekeys
  • format: A specification of how the bibliography should be formatted

returns: A formatted bibliography

item.citationkey(item_keys)

Fetch citationkeys given item keys

  • item_keys: A list of [libraryID]:[itemKey] strings. If [libraryID] is omitted, assume ‘My Library’

item.export(citekeys, translator, libraryID)

Generate an export for a list of citekeys

  • citekeys: Array of citekeys
  • translator: BBT translator name or GUID
  • libraryID: ID of library to select the items from. When omitted, assume ‘My Library’

item.notes(citekeys)

Fetch the notes for a range of citekeys

  • citekeys: An array of citekeys

item.search(searchterms)

Quick-search for items in Zotero.

  • searchterms: Terms as typed into the search box in Zotero

user.groups()

List the libraries (also known as groups) the user has in Zotero

mind that the items.export method had a bug where it would double-wrap the JSON-RPC response; the extra layer has been removed in 6.7.143, but if you were expecting the previous result you will have to update your code.