Bird
0
0

What is wrong with this cursor-based pagination response?

medium📝 Debug Q7 of 15
Rest API - Pagination Patterns

What is wrong with this cursor-based pagination response?
{"data": ["item1", "item2"], "next_cursor": null}
The client expects more data but receives next_cursor: null.

AThe API should return an empty string instead of null
BThe API indicates there are no more pages, so client should stop
CThe client must retry the request with the same cursor
DThe API response is missing the total count field
Step-by-Step Solution
Solution:
  1. Step 1: Interpret next_cursor value

    A null next_cursor means no further pages are available.
  2. Step 2: Understand client behavior

    The client should stop requesting more pages when next_cursor is null.
  3. Final Answer:

    The API indicates there are no more pages, so client should stop -> Option B
  4. Quick Check:

    next_cursor null means last page reached [OK]
Quick Trick: next_cursor null means no more pages to fetch [OK]
Common Mistakes:
  • Retrying requests when next_cursor is null
  • Expecting empty string instead of null
  • Looking for total count in cursor pagination

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes