Bird
0
0

Why is it important to use 201 Created instead of 200 OK when a new resource is created in a REST API?

hard📝 Conceptual Q10 of 15
Rest API - HTTP Status Codes
Why is it important to use 201 Created instead of 200 OK when a new resource is created in a REST API?
ABecause 201 Created explicitly informs the client that a new resource was created, enabling better client handling.
BBecause 200 OK means the server encountered an error.
CBecause 201 Created requires no response body.
DBecause 200 OK is only for DELETE requests.
Step-by-Step Solution
Solution:
  1. Step 1: Understand semantic meaning of status codes and recognize client benefits

    201 Created clearly signals resource creation, while 200 OK only signals success. Clients can react differently when they know a resource was created, such as updating UI or storing resource location.
  2. Final Answer:

    Because 201 Created explicitly informs the client that a new resource was created, enabling better client handling. -> Option A
  3. Quick Check:

    201 Created = Clear creation signal [OK]
Quick Trick: 201 Created clearly signals new resource creation [OK]
Common Mistakes:
  • Thinking 200 OK means creation
  • Ignoring client handling benefits
  • Misusing status codes for other methods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes