CSV list of tags per group

17 views
Skip to first unread message

Christoph Sander

unread,
May 2, 2022, 6:13:23 PM5/2/22
to zotero-dev
Convenient to get a JSON for all tags of a group, but the ?format=csv promts: "An error occurred"


What am I doing wrong?

Dan Stillman

unread,
May 2, 2022, 6:24:11 PM5/2/22
to zoter...@googlegroups.com
The API doesn't support CSV in any sort of general way. It's just one of
the export formats for items [1], using the same export translators
available in the desktop app.

It's trivial to parse tags from JSON, though. E.g., with jq on the
command line:

curl -vs 'https://api.zotero.org/users/475425/items/tags?limit=100' | jq
-r .[].tag >> tags
curl -vs
'https://api.zotero.org/users/475425/items/tags?limit=100&start=101' |
jq -r .[].tag >> tags

That will give you a text file with all the tags in that library.

(The 'v' is so you can look at the rel="next" value in the returned Link
header and adjust start= as necessary. For a larger library, you'd
presumably want to use something like pyzotero that would handle the
pagination for you.)

[1] https://www.zotero.org/support/dev/web_api/v3/basics#item_export_formats
Reply all
Reply to author
Forward
0 new messages