Bird
0
0

Given this API response snippet for cursor-based pagination:

medium📝 Predict Output Q4 of 15
Rest API - Pagination Patterns

Given this API response snippet for cursor-based pagination:
{"data": ["item4", "item5"], "next_cursor": "xyz789"}
What should the client do to get the next page of results?

AMake a request to the API with <code>?page=2</code> appended to the URL
BMake a request to the API with <code>?offset=5</code> appended to the URL
CMake a request to the API with <code>?cursor=xyz789</code> appended to the URL
DMake a request to the API with <code>?limit=2</code> appended to the URL
Step-by-Step Solution
Solution:
  1. Step 1: Identify the cursor token in the response

    The response includes a "next_cursor" field with value "xyz789" to indicate the next page start.
  2. Step 2: Use the cursor token in the next request

    The client should append "?cursor=xyz789" to the API URL to fetch the next page.
  3. Final Answer:

    Make a request to the API with ?cursor=xyz789 appended to the URL -> Option C
  4. Quick Check:

    Next page request uses cursor token = ?cursor=xyz789 [OK]
Quick Trick: Use next_cursor value as cursor parameter for next page [OK]
Common Mistakes:
  • Using page or offset parameters instead of cursor
  • Ignoring the next_cursor field
  • Using limit parameter alone to paginate

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes