Bird
0
0

Identify the error in this pagination metadata snippet and select the fix:

medium📝 Debug Q14 of 15
Rest API - Pagination Patterns

Identify the error in this pagination metadata snippet and select the fix:

{
  "data": [...],
  "pagination": {
    "currentPage": 1,
    "totalPages": 3,
    "perPage": 10
  }
}
ARemove the pagination object completely
BChange values to strings instead of numbers
CChange keys to snake_case: current_page, total_pages, per_page
DAdd a new key called page_count
Step-by-Step Solution
Solution:
  1. Step 1: Check key naming conventions in pagination metadata

    Standard REST API pagination metadata uses snake_case keys like current_page, total_pages, and per_page for consistency.
  2. Step 2: Identify the fix for camelCase keys

    Changing currentPage, totalPages, perPage to snake_case fixes the inconsistency and aligns with common API practices.
  3. Final Answer:

    Change keys to snake_case: current_page, total_pages, per_page -> Option C
  4. Quick Check:

    Use snake_case keys for pagination metadata [OK]
Quick Trick: Use snake_case keys for pagination metadata [OK]
Common Mistakes:
  • Leaving camelCase keys in metadata
  • Removing pagination metadata entirely
  • Changing numeric values to strings unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes