Bird
Raised Fist0

What will be the output of this HAL JSON snippet when accessing the 'next' link?

medium📝 Predict Output Q5 of Q15
Rest API - HATEOAS and Linking
What will be the output of this HAL JSON snippet when accessing the 'next' link?
{
  "_links": {
    "self": { "href": "/page/1" },
    "next": { "href": "/page/2" }
  }
}
A/page/1
B/page/2
C/page/3
D/next
Step-by-Step Solution
Solution:
  1. Step 1: Identify the 'next' link href

    The 'next' link has href "/page/2" which is the URL to the next page.
  2. Step 2: Confirm output matches the href

    The output when accessing 'next' should be "/page/2" exactly.
  3. Final Answer:

    /page/2 -> Option B
  4. Quick Check:

    next link href = /page/2 [OK]
Quick Trick: Access the href value inside the named link for output [OK]
Common Mistakes:
MISTAKES
  • Confusing self and next links
  • Guessing next page number incorrectly
  • Using link names as URLs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes