Understanding HTTP Status Codes

Rashmi Bhardwaj | Blog,Programming & Software
Advertisements

HTTP status codes are standardized codes returned by servers in response to a client’s request made to the server. These codes help the client understand the result of the request and the status of the resource they requested. The status codes are grouped into five categories based on the type of response.

Related: HTTP vs HTTPS

HTTP Status Code: Categories

Here is a breakdown of these categories and some common status codes within each:

Advertisements

1xx: Informational

1xx codes specify that the request was received and understood, and the server is continuing the process.

  • 100 Continue: The initial part of a request has been received and the client should continue with the rest of the request.
  • 101 Switching Protocols: The server is switching protocols as requested by the client.

Related – Download HTTP Status Codes CheatSheet

2xx: Success

2xx codes specify that the request was successfully received, understood, and accepted.

  • 200 OK: Request has succeeded. The information returned with the response.
  • 201 Created: Request has been fulfilled and has resulted in the creation of a new resource.
  • 204 No Content: Server not returning any content though the request has been successfully processed.

3xx: Redirection

3xx codes specify that further action needs to be taken by the client to complete the request.

  • 301 Moved Permanently: Resource requested permanently moved to a new URL.
  • 302 Found: Resource requested is temporarily located at a different URL.
  • 304 Not Modified: Resource has not been modified since the last request.

4xx: Client Error

4xx codes specify that the request contains bad syntax or cannot be fulfilled.

  • 400 Bad Request: Server cannot or will not process the request due to an apparent client error.
  • 401 Unauthorized: Authentication is required and has failed/has not yet been provided.
  • 403 Forbidden: Server understands the request but refuses to authorize it.
  • 404 Not Found: Requested resource could not be found on the server.
  • 408 Request Timeout: Server timed out while waiting for the request.

5xx: Server Error

5xx codes specify that the server failed to fulfil a valid request.

  • 500 Internal Server Error: A generic error message indicating that the server encountered an unexpected condition.
  • 501 Not Implemented: The server does not support the functionality required to fulfil the request.
  • 502 Bad Gateway: Server (acting as a gateway or proxy) received an invalid response from the upstream server.
  • 503 Service Unavailable: Server unable to handle the request currently due to temporary overloading/maintenance.
  • 504 Gateway Timeout: Server (acting as a gateway or proxy) did not receive a timely response from the upstream server.

Related: Web Socket vs HTTP: What to choose for your next API Design

Complete List of HTTP Status Codes

Here’s a list of HTTP status codes in tabular form, categorized by their class (Informational, Success, Redirection, Client Error, and Server Error):

HTTP Status CodeClassDescription
1xx
100InformationalContinue
101InformationalSwitching Protocols
102InformationalProcessing (WebDAV)
103InformationalEarly Hints
2xx
200SuccessOK
201SuccessCreated
202SuccessAccepted
203SuccessNon-Authoritative Information
204SuccessNo Content
205SuccessReset Content
206SuccessPartial Content
207SuccessMulti-Status (WebDAV)
208SuccessAlready Reported (WebDAV)
226SuccessIM Used
3xx
300RedirectionMultiple Choices
301RedirectionMoved Permanently
302RedirectionFound
303RedirectionSee Other
304RedirectionNot Modified
305RedirectionUse Proxy
306Redirection(Unused)
307RedirectionTemporary Redirect
308RedirectionPermanent Redirect
4xx
400Client ErrorBad Request
401Client ErrorUnauthorized
402Client ErrorPayment Required
403Client ErrorForbidden
404Client ErrorNot Found
405Client ErrorMethod Not Allowed
406Client ErrorNot Acceptable
407Client ErrorProxy Authentication Required
408Client ErrorRequest Timeout
409Client ErrorConflict
410Client ErrorGone
411Client ErrorLength Required
412Client ErrorPrecondition Failed
413Client ErrorPayload Too Large
414Client ErrorURI Too Long
415Client ErrorUnsupported Media Type
416Client ErrorRange Not Satisfiable
417Client ErrorExpectation Failed
418Client ErrorI’m a teapot (RFC 2324)
421Client ErrorMisdirected Request
422Client ErrorUnprocessable Entity (WebDAV)
423Client ErrorLocked (WebDAV)
424Client ErrorFailed Dependency (WebDAV)
425Client ErrorToo Early
426Client ErrorUpgrade Required
428Client ErrorPrecondition Required
429Client ErrorToo Many Requests
431Client ErrorRequest Header Fields Too Large
451Client ErrorUnavailable For Legal Reasons
5xx
500Server ErrorInternal Server Error
501Server ErrorNot Implemented
502Server ErrorBad Gateway
503Server ErrorService Unavailable
504Server ErrorGateway Timeout
505Server ErrorHTTP Version Not Supported
506Server ErrorVariant Also Negotiates
507Server ErrorInsufficient Storage (WebDAV)
508Server ErrorLoop Detected (WebDAV)
510Server ErrorNot Extended
511Server ErrorNetwork Authentication Required

These status codes are a crucial part of web communication, enabling the client and server to communicate effectively about the state and outcome of requests.

ABOUT THE AUTHOR


Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart