HTTP Status Codes
While learning RestApi I got to know about HTTP status codes which is very important to learn.
We used to come across few HTTP status codes once daily, and the famous one which one every one knows is 404 Page Not Found but don't know which family they belong
When we send a request to HTTP it will reply us back. It replied to you but if you did not know what does that mean then you wont be able to resolve the issue which you are facing.
The status code is very important because it tells how to interpret the server response.
There are 5 categories in Status Code:
a) 1xx: Informational Messages
b) 2xx: Successful
c) 3xx: Redirection
d) 4xx: Client Error
e) 5xx: Server Error
1xx: Informational Messages :- This class of codes was introduced in HTTP/1.1. The server can send a Except: 100-continue message telling the client to continue sending the remainder of the request, or ignore if it has already sent it.
2xx Successful :- This tells the client that the request was successfully processed. The most common code is 200 OK.
We used to come across few HTTP status codes once daily, and the famous one which one every one knows is 404 Page Not Found but don't know which family they belong
When we send a request to HTTP it will reply us back. It replied to you but if you did not know what does that mean then you wont be able to resolve the issue which you are facing.
The status code is very important because it tells how to interpret the server response.
There are 5 categories in Status Code:
a) 1xx: Informational Messages
b) 2xx: Successful
c) 3xx: Redirection
d) 4xx: Client Error
e) 5xx: Server Error
1xx: Informational Messages :- This class of codes was introduced in HTTP/1.1. The server can send a Except: 100-continue message telling the client to continue sending the remainder of the request, or ignore if it has already sent it.
2xx Successful :- This tells the client that the request was successfully processed. The most common code is 200 OK.
- 202 Accepted: The request was accepted but may not include the resource in the response.This is useful for async processing on the server side. The server may choose to send information for monitoring
- 204 No Content: There is no message body in the response
- 205 Reset Content: It indicates to the client to reset its document view
- 206 Partial Content: It indicates that the response only contains partial content.
3xx Redirection :- When it is unable to fetch the resource because of jump to different URL
- 301 Moved Permanently: the resource is now located at a new URL
- 303 See Other: the resource is temporarily located at new URL. The location response header contains the temporary URL
- 304 Not Modified: the server has determined that the resource has not chanegd and the client should use its cached copy. This relies on the fact that the client is sending Etag(Entity Tag) information that is a hash of the content. The server compares this with its own computed Etag to check for modifications
4xx Client Error :- These codes are used when the server thinks that client is at fault, either by requesting an invalid resource or making a bad request.
- 401 Bad Request: the request was malformed.
- 401 Unauthorized: request requires authentication. The client can repeat the request with the Authorization header. If the client already included the Authorization header, then the credentials were wrong.
- 403 Forbidden: server has denied access to the resource.
- 404 Not Found: resource is invalid and does not exist on the server.
- 405 Method Not Allowed: invalid HTTP verb used in the request line, or the server does not support that verb.
- 409 Conflict: the server could not complete the request because the client is trying to modify a resource that is newer than the client timestamp. Conflicts arise mostly for PUT requests during collaborative edits on a resource.
5xx Server Error :- This class of codes are used to indicate a server failure while processing the request.
- 500 Internal Server Error
- 501 Not Implemented: the server does not yet support the requested functionality.
- 503 Service Unavailable: this could happen if an internal system on the server has failed or the server is overloaded. Typically the server won't even respond and the request will timeout.
I hope its helpful. Will post next soon.
Comments
Post a Comment