Bird
Raised Fist0

Identify the error in this JSON snippet for a self link:

medium📝 Debug Q6 of Q15
Rest API - HATEOAS and Linking
Identify the error in this JSON snippet for a self link:
{
  "_links": {
    "self": "/orders/123"
  }
}
Aself should be an object with href key, not a string
BMissing comma after self key
CThe URL should be absolute, not relative
DThe _links key should be capitalized
Step-by-Step Solution
Solution:
  1. Step 1: Check the expected structure for self link

    Self link must be an object containing an href key with the URL string.
  2. Step 2: Identify the error in the snippet

    Here, self is directly a string, missing the href object wrapper.
  3. Final Answer:

    self should be an object with href key, not a string -> Option A
  4. Quick Check:

    Self link = object with href key [OK]
Quick Trick: Self link must be an object with href key [OK]
Common Mistakes:
MISTAKES
  • Using string instead of object for self
  • Ignoring href key requirement
  • Assuming relative URL is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes