These are the standard codes that refer to the predefined status of the task at the server. Following are the status codes formats available:
- 1xx – represents informational responses
- 2xx – represents successful responses
- 3xx – represents redirects
- 4xx – represents client errors
- 5xx – represents server errors
Most commonly used status codes are:
- 200 – success/OK
- 201 – CREATED – used in POST or PUT methods.
- 304 – NOT MODIFIED – used in conditional GET requests to reduce the bandwidth use of the network. Here, the body of the response sent should be empty.
- 400 – BAD REQUEST – This can be due to validation errors or missing input data.
- 401 – FORBIDDEN – sent when the user does not have access (or is forbidden) to the resource.
- 404 – NOT FOUND – Resource method is not available.
- 500 – INTERNAL SERVER ERROR – server threw some exceptions while running the method.
- 502 – BAD GATEWAY – Server was not able to get the response from another upstream server.