Bird
0
0

After successfully adding a new user resource via a POST request, which HTTP status code should the REST API return?

easy📝 Conceptual Q2 of 15
Rest API - HTTP Status Codes
After successfully adding a new user resource via a POST request, which HTTP status code should the REST API return?
A200 OK
B201 Created
C204 No Content
D400 Bad Request
Step-by-Step Solution
Solution:
  1. Step 1: Understand POST request purpose

    POST is used to create new resources.
  2. Step 2: Identify correct status code

    201 Created indicates successful creation of a new resource.
  3. Final Answer:

    201 Created -> Option B
  4. Quick Check:

    Use 201 for resource creation success [OK]
Quick Trick: 201 Created means new resource successfully created [OK]
Common Mistakes:
MISTAKES
  • Returning 200 OK instead of 201 Created
  • Using 204 No Content when resource is created
  • Confusing 400 Bad Request with success codes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes