Bird
0
0

Consider this REST API response code snippet:

medium📝 Predict Output Q13 of 15
Rest API - HTTP Status Codes
Consider this REST API response code snippet:
HTTP/1.1 201 Created
Location: /users/123

{"id":123,"name":"Alice"}

What does this response tell the client?
AThe client made a bad request and should try again.
BThe request failed and no resource was created.
CThe server is returning existing user data without creating anything new.
DA new user resource was created with ID 123, and its location is provided.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the status code 201 Created

    This code means a new resource was successfully created on the server.
  2. Step 2: Interpret the Location header and response body

    The Location header shows where the new resource is located (/users/123), and the body contains the new user's data.
  3. Final Answer:

    A new user resource was created with ID 123, and its location is provided. -> Option D
  4. Quick Check:

    201 Created + Location header = New resource created [OK]
Quick Trick: 201 with Location means new resource created [OK]
Common Mistakes:
  • Ignoring the Location header
  • Thinking 201 means failure
  • Confusing 201 with 200 OK

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes