Bird
0
0

What is wrong with this API call for offset-based pagination: GET /items?limit=10&offset=-5?

medium📝 Debug Q6 of 15
Rest API - Pagination Patterns
What is wrong with this API call for offset-based pagination: GET /items?limit=10&offset=-5?
AOffset should be after limit in query
BLimit cannot be 10
CNo error, this is valid
DOffset cannot be negative
Step-by-Step Solution
Solution:
  1. Step 1: Check validity of offset value

    Offset represents a starting index and must be zero or positive.
  2. Step 2: Identify the error in the call

    Offset is -5, which is invalid and will cause an error or unexpected behavior.
  3. Final Answer:

    Offset cannot be negative -> Option D
  4. Quick Check:

    Offset must be ≥ 0 [OK]
Quick Trick: Offset must never be negative [OK]
Common Mistakes:
  • Using negative offset
  • Thinking order of parameters matters
  • Assuming limit cannot be 10

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes