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
  • The Word/OO plugin API isn't documented, but you can follow along via debug output.
  • Ahh ok...

    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
  • edited November 1, 2009
    @mryckman, I'm not sure what angle you're planning to take on tying Zotero to LaTeX, or how much work you're aiming to throw into it, but with the new citeproc-js processor, it should theoretically be possible to build a working drop-in substitute for BibTeX, allowing you to use the full array of CSL styles with LaTeX.

    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.)
  • As of Zotero 2.0, the word processor plug-ins actually run as XPCOM components inside the Firefox process, communicating with the word processor via an IPC mechanism (for WinWord, OLE; for MacWord, AppleScript; for OpenOffice, UNO). These XPCOM components all implement the zoteroIntegrationApplication instance, described here. From the sound of things, however, this may not be appropriate for your use.

    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.
  • Er, right. What Simon said. I was living in the past.

    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.
  • 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.
    It isn't clear to me if you are trying to use citeproc to provide stylized citation support (as most of the above replies address) or merely a convenient way to choose citations to add to a document that bibtex will then process. If the latter, you should look at the Lytero plugin, which provides a lyxpipe interface for zotero.
  • Hello,

    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
Sign In or Register to comment.