Bird
Raised Fist0

You have an API that supports offset-based pagination and filtering by category. How would you request the second page of category 'books' with 10 items per page?

hard🚀 Application Q9 of Q15
Rest API - Pagination Patterns
You have an API that supports offset-based pagination and filtering by category. How would you request the second page of category 'books' with 10 items per page?
AGET /items?category=books&page=2&limit=10
BGET /items?category=books&offset=10&limit=10
CGET /items?category=books&limit=10&offset=20
DGET /items?offset=2&limit=10&category=books
Step-by-Step Solution
Solution:
  1. Step 1: Calculate offset for second page with 10 items

    Offset = (2 - 1) * 10 = 10.
  2. Step 2: Combine offset, limit, and filter parameters correctly

    GET /items?category=books&offset=10&limit=10 correctly includes category filter and offset=10, limit=10.
  3. Final Answer:

    GET /items?category=books&offset=10&limit=10 -> Option B
  4. Quick Check:

    Filter + offset = 10 for page 2 [OK]
Quick Trick: Combine filters with offset and limit correctly [OK]
Common Mistakes:
MISTAKES
  • Using page instead of offset
  • Wrong offset calculation
  • Misplacing query parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes