Uploading epub with api makes me unable to retrieve metadata from it

18 views
Skip to first unread message

Levi Konrad

unread,
Dec 1, 2025, 2:28:21 PM (4 days ago) Dec 1
to zoter...@googlegroups.com
Hello!

I'm trying to use the python pyzotero API to upload my EPUBS and then retrieve the metadata from them.

This process should be automatically done with the following:
```
var win = Zotero.getMainWindow();
var menu = win.document.getElementById('zotero-itemmenu');
var btn = menu.querySelector('[label="Retrieve Metadata"]');

if (btn) {
    if (typeof btn.doCommand === 'function') {
        btn.doCommand();
    } else {
        btn.click();
    }
}
var items = Zotero.getActiveZoteroPane().getSelectedItems();
return items;
```

But after uploading it looks like this:
image.png
making me unable to retrieve metadata from it

and not like this:
image.png

Only when i get into the viewer it gets recognized, and I'm able to retrieve it's metadata.


Here's the code on how I upload my EPUB:
```
                template = zot.item_template('book')
                book_res = zot.create_items([template])

                if book_res['successful']:
                    book_item = book_res['successful']['0']
                    book_key = book_item['key']
                    zot.attachment_simple([book_path], book_key)


```

If there's any way from either the API side or the client side I could go around this and automate this process, it would help me a ton!

Best Regards

Dan Stillman

unread,
Dec 1, 2025, 2:30:35 PM (4 days ago) Dec 1
to zoter...@googlegroups.com
contentType has to be 'application/epub+zip'.


On 11/30/25 6:26 PM, Levi Konrad wrote:
Hello!

I'm trying to use the python pyzotero API to upload my EPUBS and then retrieve the metadata from them.

This process should be automatically done with the following:
```
var win = Zotero.getMainWindow();
var menu = win.document.getElementById('zotero-itemmenu');
var btn = menu.querySelector('[label="Retrieve Metadata"]');

if (btn) {
    if (typeof btn.doCommand === 'function') {
        btn.doCommand();
    } else {
        btn.click();
    }
}
var items = Zotero.getActiveZoteroPane().getSelectedItems();
return items;
```

But after uploading it looks like this:

making me unable to retrieve metadata from it

and not like this:

Only when i get into the viewer it gets recognized, and I'm able to retrieve it's metadata.


Here's the code on how I upload my EPUB:
```
                template = zot.item_template('book')
                book_res = zot.create_items([template])

                if book_res['successful']:
                    book_item = book_res['successful']['0']
                    book_key = book_item['key']
                    zot.attachment_simple([book_path], book_key)


```

Stephan Hügel

unread,
Dec 2, 2025, 8:09:33 AM (3 days ago) Dec 2
to zotero-dev
Thanks Dan, that's a bug on the Pyzotero side.
Reply all
Reply to author
Forward
0 new messages