Rest API - HTTP Status CodesWhich of the following is the correct way to indicate a successful creation of a new resource in a REST API response?AHTTP/1.1 201 CreatedBHTTP/1.1 404 Not FoundCHTTP/1.1 500 Internal Server ErrorDHTTP/1.1 200 OKCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify the status code for resource creationThe status code 201 Created is used when a new resource is successfully created on the server.Step 2: Eliminate incorrect options200 OK means success but not necessarily creation; 404 and 500 are error codes.Final Answer:HTTP/1.1 201 Created -> Option AQuick Check:201 Created = New resource created [OK]Quick Trick: Use 201 Created for new resource success [OK]Common Mistakes:Using 200 OK instead of 201 for creationConfusing 404 Not Found as successMixing error codes with success codes
Master "HTTP Status Codes" in Rest API9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Rest API Quizzes HTTP Methods - DELETE for removing resources - Quiz 8hard HTTP Status Codes - 400 Bad Request - Quiz 13medium HTTP Status Codes - 409 Conflict - Quiz 11easy HTTP Status Codes - 400 Bad Request - Quiz 7medium Query Parameters and Filtering - Why flexible querying empowers clients - Quiz 12easy REST API Fundamentals - First API request and response - Quiz 2easy REST API Fundamentals - First API request and response - Quiz 12easy REST API Fundamentals - First API request and response - Quiz 10hard URL and Resource Design - Resource identifiers in URLs - Quiz 7medium URL and Resource Design - Noun-based resource naming - Quiz 8hard