Closed Mjvolk3 closed 1 year ago
This isn't currently supported by the Zotero API. See https://github.com/urschrei/pyzotero/issues/148
Thanks for your speedy response! From what I saw it looks like the issue is that they haven't documented it yet.
Hmm. I'll have to think about what the API looks like, and I'm hesitant to add public API methods for undocumented features.
In the mean time, v1.5.3 (just released to pypi) now supports annotation fields, so you can modify annotation items (retrieved as per #148), by altering their ['data']['annotationComment']
and ['data']['tags']
keys, then write the changes to your library using update_item(modified_item)
. I just tried this and the changes appear exactly as you would expect.
Ok I have upgraded to v1.5.3.
all_annotations = zot.everything(zot.items(itemType="annotation"))
print(all_annotations[0])
zot.add_tags(all_annotations[0], "test-tag")
# Error
> InvalidItemFields: Invalid keys present in item 1: annotationText
Strangely the tag is added before the template check.
print(all_annotations[0]['data']['tags'])
> [{'tag': 'test-tag'}]
Since it is updated I try the following, and of course get the same error.
zot.update_item(all_annotations[0])
# Error
> InvalidItemFields: Invalid keys present in item 1: annotationText
I check the template on zotero.py and the annotationText
is not a supported field. The following annotations fields are supported.
# annotation fields
"annotationColor",
"annotationType",
"annotationPageLabel",
"annotationPosition",
"annotationSortIndex",
"annotationComment",
Seems strange that "annotationText" isn't here. How were you able to get things to work?
🤦♂️ I left out annotationText
. I've just pushed 1.5.4 to pypi – try that? (sorry!)
Works perfectly now. Thank you!
annotationAuthorName
is also missing from the list of known keys in zotero.py, around line 1140. This prevents pyzotero from updating PDF annotations when sending back a modified version of the json returned by the API.
@EricThrift Oops. Just published 1.5.5 with a fix.
Currently the
Zotero.add_tags()
only works for metadata tags, but it would be convenient to modify tags and even update comments of annotations. It wouldn't make much sense to modify the other items of the annotation dict, maybe annotation color. My use case is to connect Zotero notes to Dendron a note taking tool in VsCode. After importing notes to Dendron, I would like to be able to modify them there, and write the changes back to Zotero. This would be possible with the requested feature. Thanks for your consideration.