Status Code Usage
Status Code are integral part of HTTP as well as REST API and should be used to differentiate different responses. These should be used by clients according to explanation.
Most of the explanation on status code is provided in link below:
In many cases REST based frameworks tend to handle status codes.
Some status code to be considered are:
200for generic successful response.201for creation of resources. Usually withPOSTrequest.204for successful request processing but no response content required.- Usually with
DELETEandPATCHPUTrequest.HEADcan be another method where this can be used.
- Usually with
400generic client issues.401usually authentication and authorization issues.403usually permission issues. We should differentiate our response between401and403401there is no authorization403there is authentication but no permission.
404the resource that client wanted is Not Found.405the HTTP request method is not allowed.