Bird
Raised Fist0

Given this HAL JSON snippet, what is the URL to access the customer's orders?

medium📝 Predict Output Q4 of Q15
Rest API - HATEOAS and Linking
Given this HAL JSON snippet, what is the URL to access the customer's orders?
{
  "_links": {
    "self": { "href": "/customers/42" },
    "orders": { "href": "/customers/42/orders" }
  }
}
A/customers/42
B/orders/42
C/customers/42/orders
D/customers/orders/42
Step-by-Step Solution
Solution:
  1. Step 1: Locate the 'orders' link in _links

    The 'orders' link has href "/customers/42/orders" which points to the customer's orders.
  2. Step 2: Confirm the URL matches the question

    The URL "/customers/42/orders" is the correct path to access orders for customer 42.
  3. Final Answer:

    /customers/42/orders -> Option C
  4. Quick Check:

    orders link href = /customers/42/orders [OK]
Quick Trick: Look for the named link in _links for the correct URL [OK]
Common Mistakes:
MISTAKES
  • Choosing the self link URL instead of orders
  • Mixing order of URL segments
  • Ignoring the exact href value

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes