Bird
0
0

A client receives this response:

medium📝 Debug Q7 of 15
Rest API - HATEOAS and Linking
A client receives this response:
{"state": "active", "actions": {}}

But the client tries to perform a "deactivate" action by POSTing to "/users/789/deactivate". The server returns 404. What is the likely cause?
AThe "deactivate" action link is missing because the user is already active and cannot be deactivated now
BThe client used the wrong HTTP method
CThe URL is incorrect and should be "/users/789/activate"
DThe server is down
Step-by-Step Solution
Solution:
  1. Step 1: Check the actions object

    It is empty, so no action links are available for current state.
  2. Step 2: Understand why 404 occurs

    Trying to POST to a URL not provided by action links results in 404 Not Found.
  3. Final Answer:

    The "deactivate" action link is missing because the user is already active and cannot be deactivated now -> Option A
  4. Quick Check:

    Missing action link = 404 on action URL [OK]
Quick Trick: Only use action URLs provided in response [OK]
Common Mistakes:
  • Assuming wrong HTTP method caused 404
  • Confusing activate and deactivate URLs
  • Blaming server downtime

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes