Hello Community,
I am Working with folders using Email API to retrieve a list of folders and have encountered an issue related to pagination and the next_cursor value.
Problem:
When I request folders using a limit greater than 10 (e.g., 200), the next_cursor returned by the API becomes very long, such as:
"next_cursor": "djE6WyJBQU1rQURRME5tSm..." // total character count is 87260
// I am not able to post whole due to post restriction
When this cursor is passed as a page_token in the next paginated request, I encounter the following error:
Error: URI Too Long
However, if I set the limit to 10 or lower, the next_cursor remains short and the pagination works correctly without any error.
My Scenario:
- Endpoint:
GET /folders?limit=200 - Using
next_cursoraspage_tokenfor pagination - Issue only occurs when
limit > 10
Questions:
- Is this a known issue with the Folders API pagination logic?
- Why does
next_cursorbecome unreasonably long for higher limits? - Is there a way to shorten or safely encode the
next_cursorto avoid this error? - Are there recommended best practices or limitations for paginating folder results?
Note:
This resembles Next_cursor in pagination got a lot bigger where cursor size scaled with limit.
Would appreciate any guidance or fixes regarding this issue.
Thanks!