Attach multiple notes to item via web API

21 views
Skip to first unread message

Annabelle Wiegart

unread,
Mar 17, 2026, 11:14:38 AM (5 days ago) Mar 17
to zotero-dev
Hi,

Has there been any change regarding the creation of items via Zotero web API? Suddenly, I'm unable to attach multiple note items to an existing book item with pyzotero like so:

book_id = 'P25VEQF7'
notes = [{'itemType': 'note', 'note': '7 mögliche Dublette(n) in DNB_A 2026_11', 'tags': [], 'collections': [], 'relations': {}}, {'itemType': 'note', 'note': 'Quelle: DNB_A 2026_11', 'tags': [], 'collections': [], 'relations': {}}]
ZOT.create_items(notes, book_id)

I'm getting the following error (example):

pyzotero.zotero_errors.PreConditionFailed:
Code: 412
URL: https://api.zotero.org/groups/4868937/items/P25VEQF7
Method: PATCH
Response: Item has been modified since specified version (expected 1198157, found 1198154)

The item was not modified except by my script. Up until last week, the same code has worked fine for months.

Best,
Annabelle

Dan Stillman

unread,
Mar 17, 2026, 12:35:28 PM (5 days ago) Mar 17
to zoter...@googlegroups.com, ursc...@gmail.com
This will probably work now.

pyzotero does this in a bit of a weird and inefficient way (creating
top-level notes in a batch and then modifying each one to be a child
note of the specified parent item, instead of just creating child notes
in a single batch request), and a recent change to the API's object
versioning behavior broke the specific pattern being used. It should now
work again, though it would still be better for pyzotero to just create
the child notes in one go.

Explanation here: https://github.com/zotero/dataserver/commit/e4f8b081b

Stephan Hügel

unread,
Mar 17, 2026, 4:46:28 PM (4 days ago) Mar 17
to zotero-dev
Thanks Dan. Inefficiency hopefully fixed in https://github.com/urschrei/pyzotero/pull/302

Annabelle Wiegart

unread,
Mar 18, 2026, 5:03:33 AM (4 days ago) Mar 18
to zoter...@googlegroups.com

Thank you Dan. That was extremely quick. It’s working again on my end now.

--
You received this message because you are subscribed to a topic in the Google Groups "zotero-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/zotero-dev/p-P6Ws3T12Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to zotero-dev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/zotero-dev/585aea18-8416-40a1-8150-2d105d83b4d3n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages