API: pagination issue - always getting "has_more" even when no items returned

I've just (finally!) updated an app I wrote to "re-link" Evernote imports to use the updated pagination API, but am hitting a problem in the latest release (1.6.7). I can retrieve all of the results, but as I increment the page parameter, has_more never seems to vanish, so I keep looping and making requests for more data, getting nothing, but not knowing when to stop. Does anyone else have this issue?

For example, from the last few iterations of retrieving all notes (token removed for clarify), if I dump the URL, the items in the response, and the number of notes retrieved I get:

http://localhost:41184/notes?token=<token>&page=77&fields=id%2Ctitle%2Ccreated_time%2Cmarkup_language%2Cuser_updated_time
dict_keys(['items', 'has_more'])
number of items: 7700
http://localhost:41184/notes?token=<token>&page=78&fields=id%2Ctitle%2Ccreated_time%2Cmarkup_language%2Cuser_updated_time
dict_keys(['items', 'has_more'])
number of items: 7722
http://localhost:41184/notes?token=<token>&page=79&fields=id%2Ctitle%2Ccreated_time%2Cmarkup_language%2Cuser_updated_time
dict_keys(['items', 'has_more'])
number of items: 7722
http://localhost:41184/notes?token=<token>&page=80&fields=id%2Ctitle%2Ccreated_time%2Cmarkup_language%2Cuser_updated_time
dict_keys(['items', 'has_more'])

any ideas? @laurent ?

Thanks!

I have tested it with 1.6.5 and 1.6.7 and it works and it works as designed.
The has_more is an boolen field, therefore it is always present therefore it is always present!

1 Like

Ahh, OK, the docs say:

Eventually you will get some results that do not contain an "has_more" paramater, at which point you will have retrieved all the results

but if it is a boolean that is always present, I'll use that instead - thanks!

Confirmed, if I update my code to check the value, not presence, of that field, everything works as expected.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.