Bird
Raised Fist0

If a REST API response includes:

medium📝 Predict Output Q5 of Q15
Rest API - HATEOAS and Linking
If a REST API response includes:
Link: <https://api.example.com/items?page=5>; rel="last", <https://api.example.com/items?page=1>; rel="first"
What do these links represent?
ANext and previous pages
BFirst and last pages of the paginated results
CCurrent and next pages
DOnly the first page repeated twice
Step-by-Step Solution
Solution:
  1. Step 1: Understand rel="first" and rel="last" meanings

    rel="first" points to the first page, and rel="last" points to the last page in pagination.
  2. Step 2: Match the URLs to their roles

    The URLs correspond to page 1 (first) and page 5 (last), indicating the range of pages.
  3. Final Answer:

    First and last pages of the paginated results -> Option B
  4. Quick Check:

    rel="first" and rel="last" = first and last pages [OK]
Quick Trick: rel="first" and rel="last" mark page range ends [OK]
Common Mistakes:
MISTAKES
  • Mixing first/last with next/prev
  • Assuming rel="last" is current page
  • Ignoring rel attribute meaning

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes