Open In App

What are HTTP Status Codes ?

Last Updated : 19 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

HTTP Protocol is used everywhere from the server page to each service communication, deploying service to monitoring service. HTTP codes give an extension of HTTP protocol to 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 performance of your site.

Why Do We Need Many HTTP Statuses?

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

HTTP Status

HTTP Status

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

HTTP Response Status Codes

Informational Responses

Message  Description
100 Continue readies for the client to continue with a request.
101 Switching Protocols that it will be switching to another protocol.
102 Processing (WebDAV) This code tells us that server is processing the request but at the current time, no response is available.
103 Early Hints This is to be used with the Link Header, where the preloading resources are started and the server prepares responses.

Success Response

Message  Description
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 given by the user is not the original owner of the request.
204 No Content  The 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.
207 Multi-Status (WebDAV) It has the work to convey multiple resources, in that case, where more than one code can be correct. 
208 Already Reported (WebDAV) It is used to avoid the repeating internal members of different binding to the same data. it is used inside <dav:propstat>.
226 IM Used (HTTP Data Encoding) Here, the response is represented by combining the result of one or more manipulations with the current instance.

Redirection Messages

Message  Description

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.

308 Permanent Redirect

It is used for locating another URL Permanently. It is done by the ‘Location:’. HTTP Response Code 301 Moved 

Permanently is similar to 308 Permanent Redirect. 

Client Error Responses

Message   Description
400 Bad Request  This response code indicates that the server detected a syntax error in the client’s request.
401 Unauthorized  The service failed because of not give 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.
418 I’m a teapot It is used to attempt to refuse coffee with a teapot.
421 Misdirected Request

This request is used to direct to a server that is not able to produce any response. Generally, it is sent 

by a  server for not producing the authorities present in the request URL.

422 Unprocessable Content (WebDAV) It occurs when the request is not followed because of semantic errors.
423 Locked (WebDAV) It refers to the locked resources.
424 Failed Dependency (WebDAV) It occurs due to the failure of a recent request.
425 Too Early It occurs when a request is made that is not processed yet.
426 Upgrade Required

It refers to when the current protocol is not considered and the system is waiting so that any other 

protocol is generated. It generates the upgrade header.

428 Precondition Required This request comes when the request is conditional. This is used to help with the lost update problem.
429 Too Many Requests This error comes when multiple requests are made in a certain amount of time.
431 Request Header Fields Too Large This comes when header fields are large enough to proceed. This request comes in that condition.
451 Unavailable for Legal Reasons

It occurs when any request is not fulfilled because of some legal reasons, it can be due to a web 

page being censored.

Server Error Responses

Message Description
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 code means that the service is temporarily unavailable, but should be restored in the future.
505 HTTP Version Not Supported Internet Engineering Task Force (IETF) Publish information usage of standard code.
506 Variant Also Negotiates

It comes with a configuration error. It is engaged in negotiation., but does not exist at

the endpoint of the negotiation process.

507 Insufficient Storage (WebDAV) It comes when the request is not to be completed because of the proper storage.
508 Loop Detected This error comes when there is an infinite loop.
510 Not Extended Some more extensions are required for the server for fulfilling it.
511 Network Authentication Required This indicates that it requires verifying network access.

FAQs

1. What are the types of HTTP Response Status Codes?

Answer:

There are 5 types of HTTP Response Status Codes.

2. Why do we need HTTP Status Codes?

Answer:

HTTP Status Codes are basically the response we get from the web browser in case of the HTTP Request. It is one of the most important part while using the Internet.

3. Which HTTP Status Code generates tells the successful transaction?

Answer:

HTTP Status Code 200 OK tells us about the successful transaction.

4. HTTP Status Code is of how many digits?

Answer:

HTTP Status Code is of 3 digits.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads