Bird
0
0

You receive this partial JSON response:

medium📝 Debug Q14 of 15
Rest API - HATEOAS and Linking
You receive this partial JSON response:
{
  "_links": {
    "self": { "href": "/products/7" },
    "edit": { "url": "/products/7/edit" }
  }
}

What is wrong with the link relations in this response?
AThe 'edit' relation uses 'url' instead of 'href'
BThe 'self' relation should not be included
CThe 'href' value for 'self' is missing a domain
DThe '_links' key should be named 'links'
Step-by-Step Solution
Solution:
  1. Step 1: Check the property names inside link relations

    Standard link relations use 'href' to specify the URL, not 'url'.
  2. Step 2: Identify the incorrect property

    The 'edit' relation incorrectly uses 'url' instead of 'href'.
  3. Final Answer:

    The 'edit' relation uses 'url' instead of 'href' -> Option A
  4. Quick Check:

    Link relation URLs must use 'href' key [OK]
Quick Trick: Link URLs always use 'href', not 'url' [OK]
Common Mistakes:
  • Thinking 'url' is acceptable instead of 'href'
  • Expecting full domain in href for relative URLs
  • Renaming '_links' to 'links' incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes