Bird
0
0

Identify the error in this hypermedia response snippet:

medium📝 Debug Q6 of 15
Rest API - HATEOAS and Linking
Identify the error in this hypermedia response snippet:
{"data": {"id": 10}, "links": {"self": "items/10"}}
AThe "data" object should not contain "id"
BThe "self" link is missing the full URL or base path
CThe "links" key should be named "urls"
DThe JSON is invalid due to missing commas
Step-by-Step Solution
Solution:
  1. Step 1: Check the "self" link format

    The "self" link is "items/10", which is a relative path missing the base URL or leading slash.
  2. Step 2: Understand best practice for hypermedia links

    Hypermedia links should be absolute URLs or at least start with a slash to avoid ambiguity.
  3. Final Answer:

    The "self" link is missing the full URL or base path -> Option B
  4. Quick Check:

    Hypermedia links need full or absolute paths [OK]
Quick Trick: Always use full or absolute URLs in hypermedia links [OK]
Common Mistakes:
  • Thinking "id" should not be in data
  • Renaming "links" to "urls" incorrectly
  • Assuming JSON syntax error without commas

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes