Skip to content
Related Articles

Related Articles

What are HTTP Status Codes ?

View Discussion
Improve Article
Save Article
  • Last Updated : 29 Mar, 2022

HTTP Protocol is used everywhere from server page to each service communication, deploying service to monitoring service. HTTP codes give an extension of HTTP protocol  debug network problems using curl, telnet able to check server availability, service responses

HTTP status code is used for search engine optimization of how your pages get indexed, as well as how search engines perceive the health of your site.

Why do we need many HTTP statuses?

It reduces complexity for client and server errors. It is also one reason why  Microservice and HATEOAS are easy to definable.

The initial line of the server’s response indicates the HTTP version and a three-digit status code. Server reserve some default error message (404 not found or 500 internal server error). Each server(Tomcat, Redhat, Web server) reserves some HTTP status for inbuild functionality. It is also possible to manually configure the status code.

Status codes are grouped as follows:

  • Informational responses (100–199)
  • Successful responses (200–299)
  • Redirection messages (300–399)
  • Client error responses (400–499)
  • Server error responses (500–599)

1. Informational responses:

  • 100 readies for the client to continue with a request
  • 101 that it will be switching to another protocol.

2. Success response:

  • 200 OK For a successful transaction
  • 201 Created For creating an entry in the database or updating details
  • 202 Accepted It might accept the request but not decided on going to create an entry
  • 203 Non-Authoritative Information  The information was given by the user is not the original owner of the request
  • 204 No Content  Response came without no entity-body
  • 205 Reset Content The browser should clear the form used for this transaction for additional input
  • 206 Partial Content The server is returning partial data of the size requested

3. Redirection: The document has moved, the server might be configured to tell clients where it has been moved

  • 300 Multiple Choices  The requested URL refers to more than one resource.
  • 301 Moved Permanently   The requested URL is no longer used by the server. The new location for the requested document is specified in the Location header. All future requests for the document should use the new URL.
  • 302 Found the redirected URL is found current working URL location
  • 303 See Other  The requested URL can be found at a different URL (specified in the Location header) and should be retrieved by a GET on that resource.
  • 304 Not Modified The URL has not been modified since the specified date. The entity-body is not sent, and the client should use its own local copy.
  • 305 Use Proxy The requested URL must be accessed through the proxy in the Location header.
  • 307 Temporary Redirect The requested URL has moved, but only temporarily.

4. Client Request Incomplete:

  • 400 Bad Request This response code indicates that the server detected a syntax error in the client’s request.
  • 401 Unauthorized The service is failed because of not giving  proper parameters like  username, password
  • 402 Payment Required This code is not yet implemented in HTTP.
  • 403 Forbidden The request was denied for a reason the server does not want to (or has no means to) indicate to the client.
  • 404 Not Found The document at the specified URL does not exist.
  • 405 Method Not Allowed This code is given with the Allow header and indicates that the method used by the client is not supported for this URL.
  • 406 Not Acceptable The URL specified by the client exists, but not in a format preferred by the client. Along with this code, the server provides the Content-Language, Content-Encoding, and Content-type headers.
  • 407 Proxy Authentication Required The proxy server needs to authorize the request before forwarding it. Used with the Proxy-Authenticate header.
  • 408 Request Time-out This response code means the client did not produce a full request within some predetermined time (usually specified in the server’s configuration), and the server is disconnecting the network connection.
  • 409 Conflict This code indicates that the request conflicts with another request or with the server’s configuration. Information about the conflict should be returned in the data portion of the reply. For example, this response code could be given when a client’s request would cause integrity problems in a database.
  • 410 Gone This code indicates that the requested URL no longer exists and has been permanently removed from the server.
  • 411 Length Required The server will not accept the request without a Content-length header supplied in the request.
  • 412 Precondition Failed The condition specified by one or more If… headers in the request evaluated to false.
  • 413 Request Entity Too Large The server will not process the request because its entity-body is too large.
  • 414 Request URL Too Long the server will not process the request because its request URL is too large.
  • 415 Unsupported Media Type The server will not process the request because its entity-body is in an unsupported format.
  • 416 Request Range Not Satisfiable The requested byte range is not available and is out of bounds.
  • 417 Expectation Failed The server is unable to meet the demands of the Expect header given by the client.

5. 500 Internal Server Error: This code indicates that a part of the server encountered a configuration error.

  • 501 Not Implemented This code indicates that the client requested an action that cannot be performed by the server.
  • 502 Bad Gateway This code indicates that the server (or proxy) encountered invalid responses from another server (or proxy).
  • 503 Service Unavailable This code means that the service is temporarily unavailable, but should be restored in the future.
  • 504 Gateway Time-out This response is like 408 (Request Time-out) except that a gateway or proxy has timed out.
  • 505 HTTP Version Not Supported

Internet Engineering Task Force (IETF) Publish information usage of standard code.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!