Bird
Raised Fist0

Given this API response for cursor-based pagination:

medium📝 Predict Output Q13 of Q15
Rest API - Pagination Patterns

Given this API response for cursor-based pagination:

{
  "data": ["item4", "item5"],
  "next_cursor": "xyz789"
}

What should the client do to get the next page of data?

ASend a request with <code>?cursor=xyz789</code>
BSend a request with <code>?page=2</code>
CSend a request with <code>?offset=2</code>
DSend a request with <code>?limit=2</code>
Step-by-Step Solution
Solution:
  1. Step 1: Read the response for next cursor

    The response includes a next_cursor value "xyz789" which marks the next data position.
  2. Step 2: Use the cursor in the next request

    The client should send a request with ?cursor=xyz789 to get the next page.
  3. Final Answer:

    Send a request with ?cursor=xyz789 -> Option A
  4. Quick Check:

    Use next_cursor value as cursor parameter [OK]
Quick Trick: Use next_cursor value as cursor in next request [OK]
Common Mistakes:
MISTAKES
  • Using page or offset parameters instead of cursor
  • Ignoring next_cursor and repeating last request
  • Sending limit without cursor

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes