Bird
0
0

You want to provide pagination links for a REST API that returns 100 items with 10 items per page. Which set of Link header relations should you include on page 5?

hard📝 Application Q8 of 15
Rest API - HATEOAS and Linking
You want to provide pagination links for a REST API that returns 100 items with 10 items per page. Which set of Link header relations should you include on page 5?
Arel="prev", rel="next" only
Brel="first", rel="prev", rel="next", rel="last"
Crel="first" and rel="last" only
DNo pagination links needed on page 5
Step-by-Step Solution
Solution:
  1. Step 1: Calculate total pages and current page

    100 items / 10 per page = 10 pages; current page is 5.
  2. Step 2: Determine which links to include on a middle page

    On page 5, include links to first (page 1), previous (page 4), next (page 6), and last (page 10) pages.
  3. Final Answer:

    rel="first", rel="prev", rel="next", rel="last" -> Option B
  4. Quick Check:

    Middle page includes all four rel links [OK]
Quick Trick: Middle pages have first, prev, next, last links [OK]
Common Mistakes:
  • Omitting first or last links
  • Not including next or prev
  • Assuming no links needed on middle pages

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes