DEV Community

Muhammad Asif
Muhammad Asif

Posted on

HTTP STATUS CODE in 5 minutes

When a client (browser) requests a URL with HTTP method, the server sends a response with a status code. Because, from these, the client can understand how to use the response of the server. The HTTP protocol divides these codes into a number of specific numbers.
Some of the most common status codes will be discussed in this post:

1. Information Response (1XX): The codes for this class range from 100 to 199. If the server returns 100, it means that everything is fine, the client can send the next request if he wants.

2. Successful Response (2XX): The codes for this class range from 200 to 299. This code means that the client's request has been completed correctly. Let's learn about some codes:

  • 200 OK: The server received the request and sent a response. I mean, everything is fine.

  • 201 Created: When the client wants to create a new resource, POST requests, and when the resource is created, the server returns 201.

  • 202 Accepted: The client has made a request and the server accepts it but can't start immediately. Then this code is returned.

  • 204 No Content: If the server accepts the request and does not send anything in response, this code is returned.

3. Redirects (3xx): Codes 300 to 399 are used when sending a request to another URL. That is, getting such a code response means the client has to take another step.

  • 301 Moved Permanently: This means that the url that the client went to is no longer there, it has been moved to the new url. So the server will return the new url.

  • 302 Found: This means that the url requested by the client is no longer available but will be available in the future.

4. Client Errors (4XX): The codes for this class range from 400 to 499. This is because of the client's error. Many times the server returns such code if it cannot process the request.

  • 400 Bad Request: Syntax is incorrect in client request.

  • 403 Forbidden: The server is not receiving this request.

  • 404 Not Found: The client's resource was not found.

5. Server Errors (5XX) : Code 500 to 599 is used for any server error.

  • 500 Internal Server Error: If there is any error in the server, it returns.

  • 501 Not Implemented: The client request is beyond the capacity of the server.

  • 502 Bad Gateway: Most of the time the server acts as a proxy server. The client's request is relayed by the proxy server to another server and the response of that server returns to the client. However, if there is a problem with this process, this code is used.

  • 503 Service Unavailable: This code is used if the server is temporarily down for any reason.

Wrapping Up

I hope you enjoyed the article, if yes then don't forget to press ❤️ and Subscribe. You can also bookmark it for later use. It was fun to create this article and If you have any queries or suggestions don't hesitate to drop them. See you.
You can extend your support by giving me stars on GitHub Profile.😊👇
Github
Portfolio

Support

Buy me a Coffee

Oldest comments (0)