Bird
0
0

An API responds with 201 Created but omits the Location header. What is the main drawback of this response?

medium📝 Debug Q7 of 15
Rest API - HTTP Status Codes
An API responds with 201 Created but omits the Location header. What is the main drawback of this response?
AThe response body must be empty
BThe resource was not actually created
CClients cannot easily find the URI of the new resource
DThe server should return 404 instead
Step-by-Step Solution
Solution:
  1. Step 1: Understand 201 Created

    It means a new resource was created successfully.
  2. Step 2: Role of Location header

    Location header tells clients where to access the new resource.
  3. Step 3: Consequence of missing Location

    Without it, clients must guess or cannot locate the resource easily.
  4. Final Answer:

    Clients cannot easily find the URI of the new resource -> Option C
  5. Quick Check:

    Location header needed for resource URI [OK]
Quick Trick: 201 Created needs Location header for resource URI [OK]
Common Mistakes:
  • Assuming resource not created without Location
  • Thinking response body must be empty
  • Confusing 201 with 404

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes