pyzotero icon indicating copy to clipboard operation
pyzotero copied to clipboard

Are new Zotero beta notes and annotations (not saved in the PDF) retrievable in Pyzotero?

Open e-alizadeh opened this issue 3 years ago • 6 comments

e-alizadeh avatar Dec 16 '21 04:12 e-alizadeh

This is really a question for the Zotero Web API maintainers: I'm not aware of any Web API methods that allow retrieval of the annotations. The google group is probably the best place to ask: https://groups.google.com/g/zotero-dev

If there are methods available, I'll add them to Pyzotero.

urschrei avatar Dec 16 '21 13:12 urschrei

Thanks for your quick reply. I further looked at this issue. Zotero beta stores annotations and highlights in their database as opposed to saving them in the PDF files itself. These new annotations are available in Zotero's new PDF editor.

As per following discussion (https://forums.zotero.org/discussion/90753/zotero-beta-integration-with-external-note-taking-tools), web API access to all annotations made in the new PDF editor is available even now. However, annotations aren't yet documented in the web API docs, even though Zotero itself syncs them via the API as a new item type.

Thanks again

e-alizadeh avatar Dec 16 '21 14:12 e-alizadeh

Yep, this is the tracking issue: https://github.com/zotero/dataserver/issues/113.

In the mean time, retrieving annotations using items(itemType='annotation') for an initial dump (which you could dump to JSON along with the library version), and then items(itemType='annotation, since=library_version) to get updates is a bit convoluted, but will work: retrieved annotations have a parentItem key in data that you can use for matching. You then also have to rebuild the annotation images from the raw data (easy in case of rects, more complicated for freehand shapes)…

urschrei avatar Dec 16 '21 14:12 urschrei

How can I retrieve all annotations? Calling items(itemType="annotation") returns 100 items only. Even passing limit with a higher number than 100 still returns 100 annotations. When calling count_items(), I can see that the number increases when I'm adding a new annotations, and I can see the new annotation when calling items(itemType="annotation") as first items. However, I'm not able to retrieve older annotations to start with!!

e-alizadeh avatar Dec 19 '21 19:12 e-alizadeh

Have you tried wrapping the call in Zotero.everything() as per the docs?

https://pyzotero.readthedocs.io/en/latest/#zotero.Zotero.everything

You can also try to build up a list of lists of annotations using one of the generator methods at

https://pyzotero.readthedocs.io/en/latest/#the-follow-and-everything-methods

And then flatten it.

-- steph

On 19 Dec 2021, at 19:28, Essi Alizadeh @.***> wrote:

 How can I retrieve all annotations? Calling items(itemType="annotation") returns 100 items only. Even passing limit with a higher number than 100 still returns 100 annotations. When calling count_items(), I can see that the number increases when I'm adding a new annotations, and I can see the annotation when calling items(itemType="annotation"). However, I'm not able to retrieve older annotations to start with!!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

urschrei avatar Dec 19 '21 19:12 urschrei

Thanks a lot. all_annotations = zot.everything(zot.items(itemType="annotation")) seems to return all annotations as you suggested. I was not using everything() func properly before.

e-alizadeh avatar Dec 19 '21 23:12 e-alizadeh