Updated documentation is available at
http://www.zotero.org/support/dev/server_api
We've implemented a node.js-based wrapper around Frank Bennett's
excellent citeproc-js CSL processor (which is also used in Zotero 2.1)
and are using it as a backend service. We'll be checking in the code for
that service to https://www.zotero.org/svn/citeproc-node/trunk/ soon.
The data server generates citeproc-js JSON for requested items and
passes it to citeproc-node.
There are currently two possible bibliographic modes, format=bib and
content=bib:
format=bib will return a formatted bibliography as XHTML with inline
CSS. For performance reasons—with the API, not with citeproc-js—this is
currently limited to 150 items. Any more will return an error. The
returned XHTML is not currently marked up with RDFa or COinS (here or in
the client), but that's one thing we'll be looking to add.
- content=bib (which is really format=atom&content=bib, but format=atom
is the default) will return a formatted reference for each item in the
item's Atom <content> block. Since the data server generates these
references individually, using numeric styles doesn't make sense for
this mode (since they'd all be "1").
Styles are currently passed as short names of Zotero Style Repo styles.
Support for arbitrary style URIs is forthcoming.
We're still tweaking and optimizing this—among other things, additional
caching and support for If-Modified-Since are needed—so feedback is
appreciated.
Examples:
https://api.zotero.org/groups/1/collections/42ZCTF3U/items?content=bib&style=apa
- Dan
Awesome!
But a quick question: can one not feed it JSON items directly?
Bruce
> There are currently two possible bibliographic modes, format=bib and
> content=bib:
>
> format=bib will return a formatted bibliography as XHTML with inline CSS.
> For performance reasons—with the API, not with citeproc-js—this is currently
> limited to 150 items. Any more will return an error. The returned XHTML is
> not currently marked up with RDFa or COinS (here or in the client), but
> that's one thing we'll be looking to add.
>
> - content=bib (which is really format=atom&content=bib, but format=atom is
> the default) will return a formatted reference for each item in the item's
> Atom <content> block. Since the data server generates these references
> individually, using numeric styles doesn't make sense for this mode (since
> they'd all be "1").
>
> Styles are currently passed as short names of Zotero Style Repo styles.
> Support for arbitrary style URIs is forthcoming.
>
> We're still tweaking and optimizing this—among other things, additional
> caching and support for If-Modified-Since are needed—so feedback is
> appreciated.
>
> Examples:
>
> https://api.zotero.org/groups/1/collections/42ZCTF3U/items?format=bib&style=chicago-note-bibliography
>
> https://api.zotero.org/groups/1/collections/42ZCTF3U/items?content=bib&style=apa
>
> - Dan
>
> --
> You received this message because you are subscribed to the Google Groups
> "zotero-dev" group.
> To post to this group, send email to zoter...@googlegroups.com.
> To unsubscribe from this group, send email to
> zotero-dev+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/zotero-dev?hl=en.
>
>
At the moment we're not opening up the backend citation service to
direct access, but we may do so once we've seen how it handles API
requests. (And, of course, with the wrapper code we release, anyone will
be able to run an equivalent service themselves.)
This is great! I wish you would have announced it about 1 week ago,
though, before I finished up hacking a mozrepl connection to get
citations from zotero for reStructuredText and org-mode. ;) Now I need
to create an alternate implementation that uses this system.
Seriously, this is a better way to do it, so I am happy about that.
By the way, is this a unique key in Zotero-land:
egh/3A8VMRJ5
That is, does the combination of username and key provide a globally
unique identifier for a bibliographic item?
best, Erik
....
> By the way, is this a unique key in Zotero-land:
>
> egh/3A8VMRJ5
>
> That is, does the combination of username and key provide a globally
> unique identifier for a bibliographic item?
... and has there been any movement on resolving the problem of tying
formatting to unique, user-specific, items?
Bruce
Yes, though there's currently no great way to resolve a username to a
userID, which the API requires. We're considering supporting usernames
directly in API requests.
Sorry, what problem are you referring to?
The API isn't really meant to be used client-side at the the moment.
That'd cause a much greater performance hit than (cached) server-side
requests, so it'd have to wait for further optimizations, and we'd also
have to add support for something like JSONP, which is designed to get
around cross-domain restrictions.
For sharing a collection from a non-public library, there are also
access considerations�you'd have to either embed a key with access to
your entire library or else make a group just for this. More
fine-grained permissions would probably be necessary for embeddable keys.
If there's significant demand for JS-based access we can explore this,
but it's unlikely to happen in the very near future.
Thank would be helpful.
As background, I have implemented a library (a “directive”) [1] for
reStructuredText [2] that allows a user of that system to insert a
citation to an item in the following way:
.. zotero:: 3A8VMRJ5
It would be nice to allow globally unique identifiers, as in:
.. zotero:: egh/3A8VMRJ5
instead, as this would allow users to cite other users items as well
as their own, and, more importantly, would allow one user to process
another user’s document. I suppose this feature is dependent on
resolving usernames.
What would probably be more popular would be to enhance luaTeX to
allow a similar feature, so that TeX users no longer rely on the (in
my mind) outdated BibTeX, but can instead write documents as:
... \cite{egh/3A8VMRJ5} ...
\bibliography
using Zotero to format their citations at the time the document is
generated, bypassing completely any export of a BibTeX document or
need to call BibTeX.
As a final thought, is there any chance that we could use the same
interface to generated citations using a local Zotero instance? That
is, it would be nice if I did not have to use one API to get a
formatted citation from zotero.org and another to get a formatted
citation from a local browser instance.
best, Erik
1. http://e6h.org/~egh/hg/zotero-plain/
2. http://docutils.sourceforge.net/rst.html
The same problems we've been discussing around document portability for ages ;-)
Bruce
I don't think that has much to do with this discussion.
Can I cite an item by URL or DOI and get back a formatted reference
from the service?
Bruce
Hi,
These work great, but I can’t seem to get this to work:
https://api.zotero.org/users/<userID>/items/<itemKey>?format=bib&key=XXX
Using content=bib does work, however:
https://api.zotero.org/users/<userID>/items/<itemKey>?content=bib&key=XXX
Is this a bug, or am I doing something wrong?
Dan also stated:
> We're considering supporting usernames directly in API requests.
Is there any progress on this? I am happy to use userids for
zotero-plain [1], though I think user names look nicer.
format=bib should now work for individual items. Thanks.
> Dan also stated
>> We're considering supporting usernames directly in API requests.
> Is there any progress on this? I am happy to use userids for
> zotero-plain [1], though I think user names look nicer.
Not yet.
Just try reloading it. Browsers sometimes ask for basic auth on api
feeds when none is required, but libraries making requests to the api
will not have any problems (nor should browsers most of the time).