HTTP Status Code

Posted by

HTTP Status Code ? Have you ever dealt with API calling or when you have visited any website where you were not able to load the website properly and noticed status codes like 400, 500.

I have covered some basic status codes which we may encounter mostly in our day to day life not only as a developer but for general use getting to know them will be helpful.

HTTP status codes are three-digit numbers that indicate the status of a HTTP (Hypertext Transfer Protocol) response from a server to a client. The status code is included in the response message header and is used to provide information about the status of the request. Here are some common HTTP status codes:

1xx (Informational): Indicates that the request was received and the server is continuing to process it.

2xx (Successful): Indicates that the request was successfully received, understood, and accepted.

3xx (Redirection): Indicates that further action needs to be taken by the user agent in order to fulfill the request.

4xx (Client Error): Indicates that the client made a bad request, such as a malformed URL or missing authentication.

5xx (Server Error): Indicates that the server encountered an error while processing the request, such as a database error or a server overload.

Some commonly encountered HTTP status codes are 200 OK (successful request), 404 Not Found (resource not found), and 500 Internal Server Error (server error).

Scenario :

Consider as a general user you tried to access a website which has a certain timings to provide services mostly like banking then in this case after the prescribed timings you try to access to a service what happens ??.

Yes you guessed it right you might get angry, disturbed and what’s not after multiple query’s but when you try to observe the status code 503 then you will understand that currently service is unavailable due to maintenance or timings so on.

Just go through the below http status codes for General Knowledge on how web works.

Http Status Codes :

200 OK :

Success is represented by this http status code 200 almost in all the network calls like POST, GET, DELETE, UPDATE…

201 CREATED :

When ever you try to post some content into your server, like creating a user record or anything related to adding a resource then this particular code is returned.

202 ACCEPTED :

When you post some data which needs to be validated / verified then this particular status code will be returned stating that your data has been accepted and is waiting for processing.


HTTP Status Code
Photo by John Schnobrich on Unsplash

400 BAD REQUEST :

If the request is not proper i.e., details missing or syntax not proper then this status code is returned.

403 FORBIDDEN :

When you are not authorized to access any content i..e, no authorization token is specified in the api call then this status code is returned.

404 NOT FOUND :

This status code is returned when the resource you are trying to find is no more available or is not at all available.

405 METHOD NOT ALLOWED :

When you try to use a methods like POST / UPDATE / PUT / DELETE, generally few websites only provide GET supported methods and when you try to POST then this status code is returned.

408 REQUEST TIMEOUT :

This request code you may find mostly when there is a lot of delay in making the api request or response best example for you to understand is OTP while making a payment after a certain time then the request is timeout.


500 INTERNAL SERVER ERROR :

When the request is not able to handle or there is any error in server side coding.Mostly related to server side coding.

501 METHOD NOT IMPLEMENTED :

When you try to access a method like POST, PUT, DELETE when they are not available.

502 BAD GATEWAY :

When there is a internal error in handling the request methods from gateway to provide the response we get this status code.

503 SERVICE UNAVAILABLE:

When the server is turned down for maintenance or due to timings the we receive this error on making a network call.

504 GATEWAY TIMEOUT:

When the gateway is not able to provide the response in time we will receive this status code.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x