In Zotero 7 beta 88, we've introduced a new local HTTP API for
accessing Zotero data, based on the
Zotero web API.
This is a near-complete read-only implementation of the web API, and
it should be a drop-in replacement for the web API for many local
tools. In fact, it's so complete that we were able to run a local
copy of the Zotero web library against the Zotero desktop app. (Due
to browser restrictions, it's not possible to follow links to
file:// URLs for attachments, but they can be used directly by
external tools.) Of course, this should also be a much better option
for tools that currently read the SQLite database directly or that
require third-party plugins for access to data.
See the comment at the top of
server_localAPI.js
for additional details. Of particular note, since this runs locally,
pagination isn't required, and the API can provide the actual
results of saved searches, which the web API itself can't currently
do.
There are still some
bugs that
we'll be fixing in upcoming versions, and we plan to add additional
functionality (write support, additional actions, possibly the
ability to run arbitrary JS) going forward.
To try out the API, make sure you're running beta 88 or later and
enable "Allow other applications on this computer to communicate
with Zotero" from the Advanced pane of the Zotero settings. You can
then run
curl
'http://localhost:23119/api/users/0/items?limit=10&sort=dateAdded'
to see your 10 most recent items.
You can post to this list with general questions about the API or if
you can't get something working. If you're pretty sure you found a
bug with the API, please open an issue in
https://github.com/zotero/zotero. (For all non-technical questions,
please continue to post to the Zotero Forums.)
We hope this opens up a new era of local integration with Zotero,
and we're excited to see what people build!
- Dan