Bird
0
0

Consider a REST API where a client sends a DELETE request to remove a resource. What is the expected behavior according to REST principles?

medium📝 Predict Output Q4 of 15
Rest API - REST API Fundamentals
Consider a REST API where a client sends a DELETE request to remove a resource. What is the expected behavior according to REST principles?
AThe resource is deleted and the server returns a 200 or 204 status code.
BThe server ignores the request and returns 404.
CThe server creates a new resource instead.
DThe client must resend the request multiple times.
Step-by-Step Solution
Solution:
  1. Step 1: Understand DELETE method behavior

    DELETE removes the resource and returns success status like 200 OK or 204 No Content.
  2. Step 2: Match expected server response

    The resource is deleted and the server returns a 200 or 204 status code. correctly describes this behavior.
  3. Final Answer:

    The resource is deleted and the server returns a 200 or 204 status code. -> Option A
  4. Quick Check:

    DELETE success = 200 or 204 [OK]
Quick Trick: DELETE returns 200 or 204 on success [OK]
Common Mistakes:
  • Expecting 404 when resource exists
  • Thinking DELETE creates resources
  • Assuming client must retry automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes