Brief Introduction to HTTP Status Codes

Brief Introduction to HTTP Status Codes

Important HTTP Status Codes.

Table of Contents

  • What is HTTP Status Code?
  • Classes of HTTP Status Codes

But, what is an HTTP Status Code?

When you make a request to the server, it returns something. For example, when you search hashnode.com the server will return the response with hashcode's web page. Along with the response, the server sends an HTTP response status code. HTTP response status code informs whether the request has been successfully completed or not.

HTTP response status codes are issued by a server in response to a client's request made to the server. HTTP status code has 3 digits in it, where the first digit defines Status-Code class.

Five classes of HTTP status codes

  1. Informational Response (100-199)
  2. Success (200-299)
  3. Redirection (300-399)
  4. Client Errors (400-499)
  5. Server Errors(500-599)

We're not going to see all of these status codes here but only the important ones from each respective class.

Informational Response (100-199)

Information response means the request has been received and is in the process.

  • 100 (continue)

The client should continue with the request. The server has received the headers and the client should send the body.

Success (200-299)

Success Response means the request is received and accepted.

  • 200 (OK)

The client's request has succeeded. The information returned with the response is dependent on the method used for the request. For example, which method is used GET, PUT, POST, or DELETE, the response will be dependent on that method.

  • 201 (Created)

The request is complete, and a resource is created. For example, a new page is created.

  • 204 (No Content)

The server successfully processed the request, but not returning any content.

Redirection (300-399)

Redirection means further action must be taken in order to complete the request.

  • 301 (Moved Permanently)

The requested page has moved to a new URI permanently.

  • 302 (Found)

The requested page has moved temporarily to a new URI.

Client Errors (400-499)

Client errors mean request contains incorrect syntax.

  • 400 (Bad Request)

The server did not understand the request.

  • 401 (Unauthorized)

The requested page needs the login of the user. For example, you visited a URI that needs to log in of the user.

  • 404 (Not Found)

The server cannot find the requested page. For example, you entered the wrong URI, and that URI doesn't exist.

Server Error (500-599)

Server error means the server is aware that it has an error or it is incapable of performing the request.

  • 500 (Internal Server Error)

The server met an unexpected condition and the request is not completed.

  • 503 (Service Unavailable)

The server is temporarily down and the request is not completed.

So, these are the important HTTP status codes. No need to remember these, just learn what does each of these status code means.