โHTTP Codes and Methods
HTTP Error Codes
HTTP error codes are standard response status codes used by web servers to indicate the outcome of a client's request. These codes are grouped into different categories, including informational, success, redirection, client errors, and server errors.
1xx (Informational Responses)
Code | Description |
---|---|
100 Continue | The request has been received, and the server is waiting for the continuation of the request. |
101 Switching Protocols | The server agrees to switch the protocol as requested by the client. |
2xx (Success Responses)
Code | Description |
---|---|
200 OK | The request has been successfully processed. |
201 Created | The request resulted in the creation of a new resource. |
204 No Content | The request was successful, but the response contains no content. |
206 Partial Content | The response contains only a portion of the requested data. |
3xx (Redirection)
Code | Description |
---|---|
300 Multiple Choices | There are multiple options available for the resource the client can access. |
301 Moved Permanently | The requested resource has been permanently moved to a new URL. |
302 Found | The requested resource is temporarily located at a different URL. |
304 Not Modified | The resource has not been modified since the last request. |
307 Temporary Redirect | The requested resource is temporarily located at a different URL, and the client should retain the original request method. |
4xx (Client Errors)
Code | Description |
---|---|
400 Bad Request | The client's request is incorrect or badly formed. |
401 Unauthorized | The client is not authenticated. |
403 Forbidden | The client lacks permission to access the requested resource. |
404 Not Found | The requested resource could not be found on the server. |
405 Method Not Allowed | The request method is not allowed for the resource. |
406 Not Acceptable | The server cannot provide a response matching the list of acceptable media types. |
407 Proxy Authentication Required | The client must authenticate with a proxy. |
408 Request Timeout | The client's request has timed out. |
409 Conflict | There is a conflict with the current state of the resource. |
429 Too Many Requests | The client has exceeded the rate limits for requests. |
5xx (Server Errors)
Code | Description |
---|---|
500 Internal Server Error | An internal server error has occurred. |
501 Not Implemented | The server does not support the requested functionality. |
502 Bad Gateway | The server acts as a gateway and has received an invalid response from an upstream server. |
503 Service Unavailable | The server is temporarily unavailable, often due to overloading or maintenance. |
504 Gateway Timeout | The server acts as a gateway and did not receive a timely response from an upstream server. |
505 HTTP Version Not Supported | The server does not support the HTTP protocol version used in the request. |
507 Insufficient Storage | The server cannot create the resource due to insufficient storage space. |
511 Network Authentication Required | The client must authenticate to access the network or resource. |
HTTP Methods
HTTP (Hypertext Transfer Protocol) defines a set of request methods to indicate the desired action to be performed for a given resource. These methods play a crucial role in shaping the communication between clients and servers in web applications. Here's an overview of some commonly used HTTP methods.
Method | Descriptions |
---|---|
HTTP GET | This retrieves a resource from the server. It is idempotent. Multiple identical requests return the same result. |
HTTP PUT | This updates or creates a resource. It is idempotent. Multiple identical requests will update the same resource. |
HTTP POST | This is used to create new resources. It is not idempotent, making two identical POST requests will duplicate the resource creation. |
HTTP DELETE | This is used to delete a resource. It is idempotent. Multiple identical requests will delete the same resource. |
HTTP PATCH | The PATCH method applies partial modifications to a resource. |
HTTP HEAD | The HEAD method asks for a response identical to a GET request but without the response body. |
HTTP CONNECT | The CONNECT method establishes a tunnel to the server identified by the target resource. |
HTTP OPTIONS | This describes the communication options for the target resource. |
HTTP TRACE | This performs a message loop-back test along the path to the target resource. |
Use this cheat sheet to quickly reference and understand the meaning of HTTP error codes and methods.
Last updated