Bird
0
0

Which JSON snippet correctly shows a hypermedia link for a REST API resource?

easy📝 Syntax Q3 of 15
Rest API - HATEOAS and Linking
Which JSON snippet correctly shows a hypermedia link for a REST API resource?
A{"links": ["/users/1"]}
B{"_links": {"self": {"href": "/users/1"}}}
C{"url": "/users/1"}
D{"link": "/users/1"}
Step-by-Step Solution
Solution:
  1. Step 1: Identify hypermedia format

    Standard hypermedia formats like HAL use a _links object with href properties.
  2. Step 2: Check options

    {"_links": {"self": {"href": "/users/1"}}} uses _links with href correctly; others do not follow hypermedia conventions.
  3. Final Answer:

    {"_links": {"self": {"href": "/users/1"}}} -> Option B
  4. Quick Check:

    HAL format uses _links and href [OK]
Quick Trick: Look for _links and href keys in JSON [OK]
Common Mistakes:
  • Using plain 'link' or 'url' keys
  • Representing links as arrays without keys
  • Omitting href property

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes