Zotero API skips certain items

Hello everyone,
I wrote a little script that iterates over all the collections of a given library and sends requests to the API. The requests look like this:
curl --location GET "$URL/groups/$GROUPID/collections/$VARIABLE/items?format=bibtex" -H "Authorization: Bearer $1" -H "Zotero-API-Version: 3" >> bibliography.bib

Everything works well, however, for two collections the API sends back fewer items than are included. The items that are skipped do not seem to be any different to the others, they are simply skipped.

Does someone have an idea how that could happen?

Thank you!

Edit: apparently removing long abstracts and the location helped. There must be a bug in the server side software, locally this does not happen.
  • (It's better to post API questions to zotero-dev. We try to keep technical discussions there.)

    We'd need to see an actual URL. You can email it to support@zotero.org with a link to this thread if you prefer (though if the group is private it shouldn't matter).
  • @bbes: There's no bug here. You're just not following the documented rel=next pagination link that the API provides. If you do, you'll end up with 19 + 14 = 33 results.

    But this isn't the right request to make anyway. For a BibTeX export, which can only use parent metadata items, you want to use /top. If you do that, you'll end up with 25 + 8 = 33 results, or you can add a limit up to 100 and just get the 33 results in one request.

    It's not totally clear to me what you're doing, but note that you also don't need to request the whole library every time — you could use versioning (Last-Modified-Version and since=) and content=bibtex to get only the items that have changed since your last request.
Sign In or Register to comment.