HTTP response status codes are crucial in web development, providing valuable insights into the outcome of a client’s request.
In our previous blog posts, we explored Informational Responses (100 – 199), Successful Responses (200 – 299), and Redirection Responses (300 – 399), learning how they establish communication, indicate success, and handle redirects.
Now, let’s dive into the fourth class of HTTP response status codes – Client Error Responses (400 – 499). These codes signify that the client’s request contains errors or cannot be fulfilled. Join us as we explore each of these client error responses in detail.
Table: HTTP Response Status Codes – Client Error Responses
|400||Bad Request||The server cannot understand the request due to bad syntax or other client-side errors.||HTTP/1.1 400 Bad Request|
|401||Unauthorized||The request requires user authentication. The client must provide valid credentials.||HTTP/1.1 401 Unauthorized|
|402||Payment Required||Reserved for future use.||HTTP/1.1 402 Payment Required|
|403||Forbidden||The server understands the request, but refuses to authorize it. The client should not repeat the request without modifications.||HTTP/1.1 403 Forbidden|
|404||Not Found||The requested resource could not be found on the server. It may have been moved or deleted.||HTTP/1.1 404 Not Found|
|405||Method Not Allowed||The request method (GET, POST, PUT, DELETE, etc.) is not allowed for the requested resource.||HTTP/1.1 405 Method Not Allowed|
|406||Not Acceptable||The requested resource cannot produce a response that is acceptable according to the headers sent in the request.||HTTP/1.1 406 Not Acceptable|
|407||Proxy Authentication Required||The client must first authenticate itself with the proxy before making the request to the server.||HTTP/1.1 407 Proxy Authentication Required|
|408||Request Timeout||The client took too long to complete the request.||HTTP/1.1 408 Request Timeout|
|409||Conflict||The request could not be completed due to a conflict with the current state of the target resource.||HTTP/1.1 409 Conflict|
|410||Gone||The requested resource is no longer available at the server and has been permanently removed.||HTTP/1.1 410 Gone|
|411||Length Required||The server requires a valid ||HTTP/1.1 411 Length Required|
|412||Precondition Failed||The server does not meet one of the preconditions specified by the client in the request headers.||HTTP/1.1 412 Precondition Failed|
|413||Payload Too Large||The server refuses to process the request because the request payload is too large.||HTTP/1.1 413 Payload Too Large|
|414||URI Too Long||The server refuses to process the request because the URI (Uniform Resource Identifier) provided is too long.||HTTP/1.1 414 URI Too Long|
|415||Unsupported Media Type||The server refuses to process the request because the media type of the request data is not supported.||HTTP/1.1 415 Unsupported Media Type|
|416||Range Not Satisfiable||The server cannot satisfy the request range specified in the ||HTTP/1.1 416 Range Not Satisfiable|
|417||Expectation Failed||The server cannot meet the requirements of the ||HTTP/1.1 417 Expectation Failed|
|418||I’m a teapot||A fun and humorous status code, not to be taken seriously. This code indicates that the server is a teapot, not designed to brew coffee.||HTTP/1.1 418 I’m a teapot|
|421||Misdirected Request||The request was directed at a server that is not able to produce a response.||HTTP/1.1 421 Misdirected Request|
|422||Unprocessable Entity||The server understands the request, but the request data is semantically incorrect or unable to be processed.||HTTP/1.1 422 Unprocessable Entity|
|423||Locked||The requested resource is locked and cannot be accessed.||HTTP/1.1 423 Locked|
|424||Failed Dependency||The request failed due to a failure of a previous request.||HTTP/1.1 424 Failed Dependency|
|425||Too Early||The server refuses to process the request because it is too early in its processing flow.||HTTP/1.1 425 Too Early|
|426||Upgrade Required||The server refuses to perform the request using the current protocol but may be willing to do so if the client upgrades to a different protocol.||HTTP/1.1 426 Upgrade Required|
|428||Precondition Required||The server requires the request to be conditional.||HTTP/1.1 428 Precondition Required|
|429||Too Many Requests||The user has sent too many requests in a given amount of time.||HTTP/1.1 429 Too Many Requests|
|431||Request Header Fields Too Large||The server refuses to process the request because the request headers are too large.||HTTP/1.1 431 Request Header Fields Too Large|
|451||Unavailable For Legal Reasons||The server refuses to provide the requested resource due to legal reasons.||HTTP/1.1 451 Unavailable For Legal Reasons|
Client error responses (status codes 400 – 499) indicate that the client’s request contains errors or is not valid for some reason. These codes are essential for identifying and diagnosing issues with client-side requests. When handling these responses, developers should provide clear error messages and guide users towards resolving the issues.
Next, we’ll explore Server Error Responses (500 – 599), which indicate that the server failed to fulfill a valid request. Happy coding!
Visit Techtalkbook to find more related topics.