Bird
0
0

Given this REST API response:

medium📝 Predict Output Q5 of 15
Rest API - HATEOAS and Linking
Given this REST API response:
{"state": "processing", "actions": {"complete": "/tasks/321/complete"}}

What is the expected outcome if the client attempts the "complete" action when the state is "pending"?
AThe server will reject the request because "complete" is invalid in "pending" state
BThe server will accept and complete the task regardless of state
CThe client will automatically update the state to "processing" before completing
DThe client can perform "complete" action anytime without restrictions
Step-by-Step Solution
Solution:
  1. Step 1: Check action availability

    The "complete" action link is provided only when the state is "processing".
  2. Step 2: State validation

    If the client tries "complete" in "pending" state, the server should reject it as invalid.
  3. Final Answer:

    The server will reject the request because "complete" is invalid in "pending" state -> Option A
  4. Quick Check:

    Action links reflect valid states only [OK]
Quick Trick: Actions valid only in current state [OK]
Common Mistakes:
  • Assuming actions work in any state
  • Thinking client auto-changes state
  • Ignoring server-side validation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes