Hi @ifarley ,
I am just starting using the Crossref REST API.
I read your post on cursor based paging: https:// community.crossref .org/t/ticket-of-the-month-march-2022-getting-started-with-rest-api-queries/2587/5#deep-paging-with-cursors-2
I want to harvest all the works that have at least one author / contributor identified with an ORCID.
Initial request: https:// api .crossref .org/works?filter=has-orcid:1&rows=1000&cursor=*
Then I obtain the cursor from .message.next-cursor
in the JSON response (DnF1ZXJ5VGhlbkZldGNoBgAAAAAVkxo0FkhUQjJYNFlSVFVPT1k5bVZmVDQzQXcAAAAAEugiXhY0amo4YndCWVRadUx4QV9WQlVKWHdnAAAAAAZWz6oWMUZXWVdYT3hUZTZtQzNpVGM3NzZoUQAAAAAWv4Z_Fk5qWk1fWm1iUVV1V3Nwd3MxN3FqQ3cAAAAAFjFcdhZDNTBUdXhPeVM0bUg3UnZzcl9lR2N3AAAAABPuERgWSTFVWlpBeGRTWi1nRllxOU9nQUYydw==) to make the subsequent request(s), e.g., https:// api .crossref .org/works?filter=has-orcid:1&rows=1000&cursor=DnF1ZXJ5VGhlbkZldGNoBgAAAAAVkxo0FkhUQjJYNFlSVFVPT1k5bVZmVDQzQXcAAAAAEugiXhY0amo4YndCWVRadUx4QV9WQlVKWHdnAAAAAAZWz6oWMUZXWVdYT3hUZTZtQzNpVGM3NzZoUQAAAAAWv4Z_Fk5qWk1fWm1iUVV1V3Nwd3MxN3FqQ3cAAAAAFjFcdhZDNTBUdXhPeVM0bUg3UnZzcl9lR2N3AAAAABPuERgWSTFVWlpBeGRTWi1nRllxOU9nQUYydw%3D%3D
I URL encode the cursor for this purpose (“==” at the end are encoded.)
The thing that I struggle to understand is the way cursors are handled. Normally, a cursor is a base64 encoded string that can be decoded, resulting in some kind of pointer such as an id etc. With each request, the pointer changes and so does the next cursor.
Here, however, a cursor remains the same once obtained (this is at least what I experienced). Does this mean that the server holds some sort of state for a given cursor that changes each time a request ist made?
So in other words, aside from the first request, all subsequent requests are the same URL but for each requests, different results are returned?
I found this:
The problem is this- if you are doing a long sequence of cursor requests, and the API (or your script) becomes unstable in the middle of the sequence, and you get an error, you will have to start from scratch with a new cursor.
https:// www. crossref. org/documentation/retrieve-metadata/rest-api/tips-for-using-the-crossref-rest-api/
What I also noticed is that "query":{"start-index":0}
increments with offset based pagination but not when using a cursor.
Thanks for clarification and kind regards,
Tobias