Bird
0
0

Given the following HAL JSON snippet, what is the URL to access the customer's details?

medium📝 Predict Output Q13 of 15
Rest API - HATEOAS and Linking
Given the following HAL JSON snippet, what is the URL to access the customer's details?
{
  "_links": {
    "self": { "href": "/orders/123" },
    "customer": { "href": "/customers/456" }
  },
  "orderNumber": "123"
}
A/orders/123
B/customers/456
C/orders/456
D/customers/123
Step-by-Step Solution
Solution:
  1. Step 1: Identify the customer link in _links

    The customer key has an href value of "/customers/456" which points to the customer's details URL.
  2. Step 2: Confirm other options

    self points to the order URL "/orders/123". Other options mix order and customer IDs incorrectly.
  3. Final Answer:

    /customers/456 -> Option B
  4. Quick Check:

    Customer link = _links.customer.href = /customers/456 [OK]
Quick Trick: Look inside _links for the named resource URL [OK]
Common Mistakes:
  • Confusing self with customer link
  • Mixing order and customer IDs
  • Ignoring the href property

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes