Bird
0
0

Why does HAL use the _links and _embedded keys instead of placing links and embedded resources directly at the root level?

hard📝 Conceptual Q10 of 15
Rest API - HATEOAS and Linking
Why does HAL use the _links and _embedded keys instead of placing links and embedded resources directly at the root level?
ATo clearly separate metadata (links) and embedded resources from the main data
BTo reduce the size of the JSON response
CTo enforce strict typing of all fields
DTo allow only one link per resource
Step-by-Step Solution
Solution:
  1. Step 1: Understand HAL design goals

    HAL uses _links and _embedded to separate navigation and related resources from the main resource data clearly.
  2. Step 2: Evaluate other options

    Reducing size is not the main goal, strict typing is not enforced by HAL, and multiple links per resource are allowed.
  3. Final Answer:

    To clearly separate metadata (links) and embedded resources from the main data -> Option A
  4. Quick Check:

    _links and _embedded separate metadata and data [OK]
Quick Trick: Use _links and _embedded to separate data and navigation [OK]
Common Mistakes:
  • Thinking HAL reduces JSON size
  • Assuming HAL enforces strict typing
  • Believing only one link per resource is allowed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes