Bird
0
0

Given the HTTP Link header:

medium📝 Predict Output Q13 of 15
Rest API - HATEOAS and Linking
Given the HTTP Link header:
Link: <https://api.example.com/items?page=3>; rel="next", <https://api.example.com/items?page=1>; rel="prev"
What URL should the client use to get the previous page?
Ahttps://api.example.com/items?page=3
Bhttps://api.example.com/items?page=4
Chttps://api.example.com/items?page=1
Dhttps://api.example.com/items?page=2
Step-by-Step Solution
Solution:
  1. Step 1: Identify rel attributes in Link header

    Rel="next" points to page 3, rel="prev" points to page 1.
  2. Step 2: Find URL for previous page

    The client should use the URL with rel="prev", which is page 1.
  3. Final Answer:

    https://api.example.com/items?page=1 -> Option C
  4. Quick Check:

    Prev page URL = page=1 [OK]
Quick Trick: Look for rel="prev" to find previous page URL [OK]
Common Mistakes:
  • Choosing the next page URL instead of previous
  • Confusing page numbers in URLs
  • Ignoring rel attribute values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes