Bird
Raised Fist0

How should you correctly represent an action link named reject with URL /applications/789/reject in a REST API JSON response?

easy📝 Syntax Q3 of Q15
Rest API - HATEOAS and Linking
How should you correctly represent an action link named reject with URL /applications/789/reject in a REST API JSON response?
A{"actions": ["reject": "/applications/789/reject"]}
B{"actions": {"reject": "/applications/789/reject"}}
C{"actions": {"reject" => "/applications/789/reject"}}
D{"actions": {"reject"; "/applications/789/reject"}}
Step-by-Step Solution
Solution:
  1. Step 1: JSON object syntax

    JSON objects use key-value pairs with colon separators inside curly braces.
  2. Step 2: Correct format

    {"actions": {"reject": "/applications/789/reject"}} correctly uses a JSON object with "reject" as key and URL as string value.
  3. Final Answer:

    {"actions": {"reject": "/applications/789/reject"}} -> Option B
  4. Quick Check:

    Check for colon and braces in JSON [OK]
Quick Trick: Use colon for key-value pairs in JSON [OK]
Common Mistakes:
MISTAKES
  • Using brackets instead of braces for objects
  • Using => or ; instead of colon
  • Incorrect array syntax for objects

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes