data access API
Hello,
Is there documentation available for how the outside plugins get data from zotero? I was interested in putting together a sort of plugin for LaTex, but was hoping to void picking through all the word plugin's code.
Thanks,
Mike
Is there documentation available for how the outside plugins get data from zotero? I was interested in putting together a sort of plugin for LaTex, but was hoping to void picking through all the word plugin's code.
Thanks,
Mike
Sorry if this is a weird question... but is there a plan to make a generally accessible zotero API? I was just thinking that it would be cool if (while firefox was running) we could send requests for actions through some service.
Presumably the word plugin is (at least in part) doing some of that... Do you know if there's a long term plan to expand and document something like that?
Thanks
You should be able to produce output for a *.bbl file (if I remember the naming conventions correctly) by just supplying appropriate values and functions in an output format definition. That's all done in a single location in the sources, and there aren't all that many items to cover:
http://bitbucket.org/fbennett/citeproc-js/src/tip/src/formats.js
Then on LaTeX-side, a generic "csl support package" would need to have definitions for any special-purpose environments or commands that you write into the *.bbl file, and be able to read the entries written into the *.bbl file, one per \cite command.
On the other hand, it may be that the world isn't eager for yet another means of formatting bibliographic data in LaTeX. :)
(EDIT: Reading over the above, I realized that it might not be obvious how you would run a Javascript application in this way. There's a good Python-Javascript bridge for the Spidermonkey JS interpreter that you could use to build a wrapper for citeproc-js. The wrapper would be pure python, so the tool could read in the *.aux laid down by LaTeX with Python, pass it across the bridge to the JS interpreter for formatting, receive the result back and relay it to the *.bbl file. Might sound complicated, but it would get you quite a bit of value for money, so to speak.)
There's an example of a rudimentary HTTP server for data access in dataServer.js, although this is disabled by default, may be insecure, and may not function. In integration.js, you can also find code to open and read from a named pipe on non-Windows platforms, although you'd have to write the functions to process what comes in and provide appropriate output. If you want to go this route, the client API docs might help you get started.
There are also plans for a server-based API, although I'm not sure on the current status.
If you don't mind a dependency, you can use something like MozRepl to give you a telnet session into Firefox's internal JavaScript environment, from which you can use the client API that Simon mentions above. This is actually what we use currently to generate previews for the styles page (though now that citeproc-js is available and can run in a server environment we'll be switching to that). You'd want to be sure to bind the telnet server only to localhost, of course.
The server API is largely in place—and is used for, say, Atom feeds for libraries on zotero.org—but we haven't yet released documentation on it, and it might not yet support everything you'd need (such as search). You also might want a local solution.
The reason I was interested wasn't strictly for LaTex, although that's probably the most obvious use. It seemed that (at least in how it used to work) the word plugin was using a service that zotero hosted on port 50001. I thought that if that was built out, it could lead to many additional plugins that could do all sorts of things. As I mentioned, the main interest I had was in making a simple command line program that would take a file path and export the zotero library as a bibtex file somewhere. Naturally, you could build that out to use different key formats, export only certain collections or libraries... whatever.
But yeah, the main interest was in whether there was such a service available and, if so, how to use it...
Mike