How can you use Link headers to help clients navigate a filtered list where some pages might be empty? Choose the best approach.
hard📝 Application Q9 of 15
Rest API - Pagination Patterns
How can you use Link headers to help clients navigate a filtered list where some pages might be empty? Choose the best approach.
AAlways include links to all pages regardless of content
BInclude only links to pages with data using rel="next" and rel="prev"
CUse rel="empty" for pages without data
DExclude Link headers entirely when pages are empty
Step-by-Step Solution
Solution:
Step 1: Consider client navigation needs
Clients should only follow links to pages that contain data to avoid empty results.
Step 2: Evaluate options
Including only valid next and previous pages helps clients navigate efficiently. rel="empty" is not a standard relation, and excluding Link headers removes navigation aid.
Final Answer:
Include only links to pages with data using rel="next" and rel="prev" -> Option B
Quick Check:
Link headers should guide to valid pages only [OK]
Quick Trick:Link only to pages with data to avoid empty navigation [OK]
Common Mistakes:
Linking to empty pages
Inventing non-standard rel values
Removing Link headers when pages are empty
Master "Pagination Patterns" in Rest API
9 interactive learning modes - each teaches the same concept differently