HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped into five classes: informational responses, successful responses, redirects, client errors, and server errors.
Here are the 10 commonly used and useful HTTP status codes:
None in this class.
It is the general status code. Most common code used to indicate success.
The request has succeeded. The meaning of success varies depending on the HTTP method:
GET: The resource has been fetched and is transmitted in the message body.
HEAD: The entity headers are in the message body.
PUT or POST: The resource describing the result of the action is transmitted in the message body.
TRACE: The message body contains the request message as received by the server
Successful creation occurred (via either POST or PUT). Set the Location header to contain a link to the newly-created resource (on POST). Response body content may or may not be present.
Status when wrapped responses are not used and nothing is in the body (e.g. DELETE).
This is used for caching purposes. It tells the client that the response has not been modified, so the client can continue to use the same cached version of the response.
General error when fulfilling the request would cause an invalid state. Domain validation errors, missing data, etc. are some examples.
The error code response for missing or invalid authentication token.
The error code for a user not authorized to perform the operation or the resource is unavailable for some reason (e.g. time constraints, etc.).
Used when the requested resource is not found, whether it doesn't exist or if there was a 401 or 403 that, for security reasons, the service wants to mask.
Whenever a resource conflict would be caused by fulfilling the request. Duplicate entries and deleting root objects when cascade-delete is not supported are a couple of examples.
The general catch-all error when the server-side throws an exception.