Return an informative HTTP status code

Return a status code that informs the requestor of the success or failure of the request.

Return an HTTP status code that helps the client understand the result of the request. Use the following guidelines for common status codes.

Table 1. Common status codes
Status code Description
200 Indicates that the request was completed successfully.
201 Indicates that a record was created successfully.
204 Indicates that a record was deleted successfully.
40X (401, 404) Status codes in the 400 range indicate a client error, such as 400 for invalid request syntax.
50X (500, 503) Status codes in the 500 range indicate that a server error occurred. The client request may have been valid or invalid, but a problem occurred on the server that prevented it from processing the request.