A HTTP response includes a status code - a numeric code and a human-readable description. The codes themselves are 3-digit numbers, with the first number indicating a general category the response status falls into. Essentially, the status code indicates that the request is being fulfilled, or the reason it cannot be.
1XX Status Codes
Codes falling in the 100’s provide some kind of information, often in response to a HEAD
or upgrade request. See the MDN Documentation for a full list.
2XX Status Codes
Codes in the 200’s indicate success in some form. These include:
200 OK
A status of 200 indicates the request was successful. This is by far the most common response.
201 Created
Issued in response to a successful POST request, indicates the resource POSTed to the server has been created.
202 Accepted
Indicates the request was received but not yet acted upon. This is used for batch-style processes. An example you may be familiar with is submitting a DARS report request - the DARS server, upon receiving one, adds it to a list of reports to process and then sends a 202
response indicating it was added to the list, and should be available at some future point.
There are additional 200 status codes. See the MDN Documentation for a full list.
3XX Status Codes
Codes in the 300’s indicate redirects. These should be used in conjunction with a Location
response header to notify the user-agent where to redirect. The three most common are:
301 Moved Permanently
Indicates the requested resource is now permanently available at a different URI. The new URI should be provided in the response, and the user-agent may want to update bookmarks and caches.
302 Found
Also redirects the user to a different URI, but this redirect should be considered temporary and the original URI used for further requests.
304 Not Modified
Indicates the requested resource has not changed, and therefore the user-agent can use its cached version. By sending a 304, the server does not need to send a potentially large resource and consume unnecessary bandwidth.
There are additional 300 status codes. See the MDN Documentation for a full list.
4XX Status Codes
Codes in the 400’s indicate client errors. These center around badly formatted requests and authentication status.
400 Bad Request
is a request that is poorly formatted and cannot be understood.
401 Unauthorized
means the user has not been authenticated, and needs to log in.
403 Forbidden
means the user does not have permissions to access the requested resource.
404 Not Found
means the requested resource is not found on the server.
There are many additional 400 status codes. See the MDN Documentation for a full list.
5XX Status Codes
Status codes in the 500’s indicate server errors.
500 Server Error
is a generic code for “something went wrong in the server.”
501 Not Implemented
indicates the server does not know how to handle the request method.
503 Service Unavailable
indicates the server is not able to handle the request at the moment due to being down, overloaded, or some other temporary condition.
There are additional 500 status codes. See the MDN Documentation for a full list.