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.
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.
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).
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 alimit
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
andsince=
) andcontent=bibtex
to get only the items that have changed since your last request.