Bird
0
0

You have this REST API response snippet:

medium📝 Debug Q14 of 15
Rest API - HATEOAS and Linking
You have this REST API response snippet:
{
  "id": 5,
  "name": "Alice",
  "related": "api.example.com/users/5/friends"
}

Why might this related link cause problems for clients?
AThe related link points to a wrong resource
BThe URL is missing the protocol (http:// or https://)
CThe JSON format is invalid
DThe related link is too long
Step-by-Step Solution
Solution:
  1. Step 1: Check the related link format

    The link "api.example.com/users/5/friends" lacks the protocol prefix like "https://" which is required for clients to resolve the full URL.
  2. Step 2: Identify the impact

    Without the protocol, clients may fail to fetch the related resource or assume a wrong protocol, causing errors.
  3. Final Answer:

    The URL is missing the protocol (http:// or https://) -> Option B
  4. Quick Check:

    Related links need full URLs with protocol [OK]
Quick Trick: Always include http:// or https:// in related links [OK]
Common Mistakes:
  • Ignoring missing protocol in URLs
  • Thinking JSON is invalid due to link format
  • Assuming link length causes issues

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes