Important HTTP codes for Rest web services

As all of us know that when we send a request to HTTP server, server returns the response of the request and also send a  status code. these status codes have special meaning for the client so a as software engineer  we must have knowledge about these codes. HTTP code have three digits like 200.

As we know that web services like consumes by program not directly by user, so web services should return HTTP status code very carefully, because based on these case consumer of web service will take action.

Here I am listing some of the Important status code that everyone should know.
I took this article from This site explain all the available status code very nicely.

There are 5 categories of HTTP code.

Category 1 : Start with digit "1"
1xx: Informational - Request received, continuing process

Category 2 : Start with digit "2"
2xx: Success - The action was successfully received, understood, and accepted

Category 3 : Start with digit "3"
3xx: Redirection - Further action must be taken in order to complete the request

Category 4 : Start with digit "4"
4xx: Client Error - The request contains bad syntax or cannot be fulfilled

Category 5 : Start with digit "5"
5xx: Server Error - The server failed to fulfill an apparently valid request

Here we are listing some important status code --

200     OK - client's request was successfully received, understood, and accepted.

201     Created - The request has been fulfilled and resulted in a new resource being created

202     Accepted- The request has been accepted for processing, but the processing has not been completed

301     Moved Permanently - The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs

302     Found - The requested resource resides temporarily under a different URI.

307     Temporary Redirect - The requested resource resides temporarily under a different URI

400     Bad Request - could not be understood by the server due to malformed syntax

401     Unauthorized

404     Not Found - The server has not found anything matching the Request-URI

405     Method Not Allowed -  The method specified in the Request-Line is not allowed for the resource identified by the Request-URI

406     Not Acceptable

500     Internal Server Error- The server encountered an unexpected condition which prevented it from fulfilling the request

503     Service Unavailable - The server is currently unable to handle the request due to a temporary overloading or maintenance

REST Architecture

No comments:

Post a Comment