Bird
Raised Fist0

You want to include multiple link relations in a REST API response header for pagination: first page, previous page, next page, and last page. How should you format the Link header?

hard🚀 Application Q8 of Q15
Rest API - HATEOAS and Linking
You want to include multiple link relations in a REST API response header for pagination: first page, previous page, next page, and last page. How should you format the Link header?
ALink: rel="first" </page/1>, rel="prev" </page/2>, rel="next" </page/4>, rel="last" </page/10>
BLink: </page/1> rel=first, </page/2> rel=prev, </page/4> rel=next, </page/10> rel=last
CLink: </page/1>; rel="first", </page/2>; rel="prev", </page/4>; rel="next", </page/10>; rel="last"
DLink: first </page/1>, prev </page/2>, next </page/4>, last </page/10>
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct Link header format for multiple links

    Multiple links are separated by commas, each with <URL>; rel="type" syntax.
  2. Step 2: Match options with correct syntax

    Link: ; rel="first", ; rel="prev", ; rel="next", ; rel="last" correctly uses commas, angle brackets, semicolons, and quoted rel values.
  3. Final Answer:

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

    Multiple links use commas and rel="type" syntax [OK]
Quick Trick: Separate multiple links with commas and quote rel values [OK]
Common Mistakes:
MISTAKES
  • Not separating links with commas
  • Not quoting rel values
  • Placing rel before URL

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes