Top 10 HTTP Status Codes:
Today we are going to discuss Top 10 HTTP Status Codes and their use in programming. Many time we are confuse, when we sea this type of status code and also we are not able to identify what is the meaning of this status code.
If you are API developer or frontend developer then this is very important for you to know this all status code and their use, because when ever we are going to develop any API and integrate any API then we need know these all status code and their meaning.
1. 200 Status (Ok/Success)
This is General success status code. Most common code to indicate success.
When API developer write any get API (GET API means when we are try to get information from database or from any where, if we are getting proper result from API than the status code will 200 and message is like Ok/Success from https. If we are frontend developer then based on this status we are redirect the page or show the information on page or do whatever you want to do.
2. 201 Status (Created)
Successful creation occurred (via either POST or PUT). Set the Location header to
contain a link to the newly-created resource. Response body content may or may not be present.
3. 204 Status (No Content)
We are getting this status when wrapped responses are not used and nothing is in the body (e.g. DELETE).
4. 304 Status (Not Modified)
This status is used in response to conditional GET calls to reduce band-width usage. If used, must set the Date, Content-Location, Etag headers to what they would have been on a regular GET call. There must be no response body.
5. 400 Status (Bad Request)
General this status means error, when fulfilling the request would cause an invalid state. Domain validation errors, missing data, user name or password are not valid etc. are some examples.
6. 401 Status (Unauthorized)
This is Error code for a missing or invalid authentication token. If you are try to access any API without authentication token or valid token then this types of error will come .
7. 403 Status ( Forbidden)
Error code for user not authorized to perform the operation, doesn’t have rights
to access the resource, or the resource is unavailable for some reason (e.g. time constraints, etc.).
403 status code are coming when you are restrict to get the action, eg. simple like any admin group member able to do all operation in that group but other member are restrict to do all operation.
8. 404 Status (Not Found)
404 status used when the requested resource is not found, whether it doesn’t exist or if there was a 401 or 403 that, for security reasons, the service wants to mask.
9. 409 Status (Conflict)
Whenever a resource conflict would be caused by fulfilling the request. Duplicate entries, deleting root objects when cascade-delete not supported are a couple of examples.
10 5001 Status (Internal Server Error)
The general catch-all error when the server-side throws an exception.
Read more topics related to java
- Multithreading in java
- Inter thread communication in java
- synchronization in java
- Exception in java
- Inner class in java
Hope this was helpful for you. If you have any questions please feel free to leave a comment. Thank you for reading.