My Publications + Zotero API ?

101 views
Skip to first unread message

Frank Bennett

unread,
Oct 7, 2017, 10:07:24 AM10/7/17
to zotero-dev
I'm working on a faculty website, for which we're curating staff publications in a Zotero group, and building bib pages for the site by pulling JSON data over the Zotero API.

It works swimmingly, but some trusted colleagues want to take full control over their content. For that, we'll need to pull their JSON data from a Zotero account that is personal to them.

I'm wondering what the best approach is for that. The obvious thing would be to pull their My Publications content, but I'm not sure of a couple of things:

1. Is there a way to target My Publications via the API (i.e. as a tag, or as a collection)?
2. Can My Publications be exposed to public access separately from My Library?

(Or possibly there are other ways to manage the requirement that I've not spotted.)

Pointers on the two questions above greatly appreciated.

Frank

fcheslack

unread,
Oct 7, 2017, 10:17:51 AM10/7/17
to zoter...@googlegroups.com
1. https://api.zotero.org/users/<userID>/publications/items
2. It's always public.
> --
> You received this message because you are subscribed to the Google Groups
> "zotero-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to zotero-dev+...@googlegroups.com.
> To post to this group, send email to zoter...@googlegroups.com.
> Visit this group at https://groups.google.com/group/zotero-dev.
> For more options, visit https://groups.google.com/d/optout.

fcheslack

unread,
Oct 7, 2017, 10:19:43 AM10/7/17
to zoter...@googlegroups.com
And the code we use for putting these on zotero.org profile pages is
https://github.com/zotero/publications

Dan Stillman

unread,
Oct 7, 2017, 3:56:16 PM10/7/17
to zoter...@googlegroups.com
On 10/7/17 10:19 AM, fcheslack wrote:
And the code we use for putting these on zotero.org profile pages is
https://github.com/zotero/publications

Yeah, while we haven't publicized it yet, we built the publications feature to be usable as a standalone library on third-party sites. It can also be used via Node for server-side rendering.

We'll be updating it along with improvements to the website, but feel free to create issues on GitHub in the meantime.

Frank Bennett

unread,
Oct 7, 2017, 6:50:19 PM10/7/17
to zoter...@googlegroups.com
Brilliant! Exactly what I was hoping for.

Frank


> To post to this group, send email to zoter...@googlegroups.com.
> Visit this group at https://groups.google.com/group/zotero-dev.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "zotero-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zotero-dev+unsubscribe@googlegroups.com.

Stephan Hügel

unread,
Oct 8, 2017, 9:55:15 AM10/8/17
to zotero-dev
(Now also available on Pyzotero)

> To post to this group, send email to zoter...@googlegroups.com.
> Visit this group at https://groups.google.com/group/zotero-dev.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "zotero-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zotero-dev+...@googlegroups.com.

Frank Bennett

unread,
Oct 8, 2017, 8:21:13 PM10/8/17
to zotero-dev
I think I've hit a snag.

On our website, we want to show staff publications by category, so that postgraduate applicants to our programs can identify professors that work in their target area, and craft their applications to fit our supervision capabilities. Categories are a controlled list of tags that we apply to each publication. To put things together, we fetch JSON from the API using NPM libzotero, and do all the necessary remangling locally to build static pages.

To get JSON from a publications library, I loosened the constraints in a copy of NPM libzotero (so that I can call userID + '/publications'). That works, but in the return, the data element (itemJson.data) does not have a 'tags' child element. I'm guessing at this a bit, because I haven't dug into the libzotero code for it, but it looks like the 'publications' library API is just not returning the tags. So the questions are:

1. Have I guessed correctly there? and if so 
2. Is it possible to include tags in JSON data returned from the <userID>/publications API?

Frank

Frank Bennett

unread,
Oct 8, 2017, 8:58:28 PM10/8/17
to zotero-dev
Playing with curl, it does look like tags are omitted:

    curl https://api.zotero.org/users/<userID>/publications/items

returns a data object with no tags element. Also,

    curl https://api.zotero.org/users/<userID>/publications/tags

returns "Not Found."

Tags are recognized for search though:

    curl https://api.zotero.org/users/<userID>/publications/items?tag=Publish

returns the single item in my My Publications that has the "Publish" tag.

Frank Bennett

unread,
Oct 9, 2017, 3:49:12 AM10/9/17
to zoter...@googlegroups.com
I've found a way around the issue for now. After calling the items
from /publications, if I have an API access key for the library, I can
compose a query that fetches the items from My Library, with tags.
After that, processing can proceed as it does in the collective
library.

If there are not performance reasons for dropping tags, it would be
simpler to get them in one go, though.

Frank
>>>> > email to zotero-dev+...@googlegroups.com.
>>>> > To post to this group, send email to zoter...@googlegroups.com.
>>>> > Visit this group at https://groups.google.com/group/zotero-dev.
>>>> > For more options, visit https://groups.google.com/d/optout.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "zotero-dev" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to zotero-dev+...@googlegroups.com.
>>>> To post to this group, send email to zoter...@googlegroups.com.
>>>> Visit this group at https://groups.google.com/group/zotero-dev.
>>>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "zotero-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to zotero-dev+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages