Bird
0
0

Identify the error in this API call for pagination: GET /items?limit=5&offset=-10

medium📝 Debug Q14 of 15
Rest API - Query Parameters and Filtering

Identify the error in this API call for pagination: GET /items?limit=5&offset=-10

AOffset should be a string
BLimit cannot be 5
CNegative offset is invalid
DLimit must be greater than offset
Step-by-Step Solution
Solution:
  1. Step 1: Check offset value

    Offset represents the starting position and cannot be negative because you cannot start before the first item.
  2. Step 2: Validate limit and offset rules

    Limit can be any positive number; offset must be zero or positive.
  3. Final Answer:

    Negative offset is invalid -> Option C
  4. Quick Check:

    Offset ≥ 0 required [OK]
Quick Trick: Offset must never be negative [OK]
Common Mistakes:
  • Allowing negative offset
  • Confusing limit and offset roles
  • Assuming offset can be string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes