Bird
Raised Fist0

You receive this REST API response:

medium📝 Debug Q6 of Q15
Rest API - HATEOAS and Linking
You receive this REST API response:
{
  "product": {
    "id": 7,
    "links": {
      "reviews": "/products/7/reviews"
    }
  }
}

Why might this cause problems for clients expecting related resource links?
AThe links property should be an array
BThe reviews link is a string, not an object with href property
CThe reviews URL is incorrect
DThe product id is missing
Step-by-Step Solution
Solution:
  1. Step 1: Identify expected link format

    Clients often expect related links as objects with an href key for consistency.
  2. Step 2: Check actual link format

    Here, "reviews" is a string URL, not an object, which may break clients parsing links.
  3. Final Answer:

    The reviews link is a string, not an object with href property -> Option B
  4. Quick Check:

    Link format mismatch = The reviews link is a string, not an object with href property [OK]
Quick Trick: Use consistent object format with href for links [OK]
Common Mistakes:
MISTAKES
  • Ignoring link format consistency
  • Assuming string URLs always work
  • Confusing missing id with link format

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes