This article will cover common Success, Client Error and Server Error status codes used for RESTful services. The below tables provide the different types of HTTP status codes with a description.
2xx Success
These status codes indicate that the client’s request was successfully received, understood and accepted.
Code | Description |
---|---|
200 | OK |
201 | Created |
202 | Accepted |
204 | No Content |
4xx Client Error
These status codes indicate that the client provided an error in the request.
Code | Description |
---|---|
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
405 | Method Not Allowed |
409 | Conflict |
410 | Gone |
5xx Server Error
These status codes indicate that the server is aware it has made an error or is incapable of performing the request.
Code | Description |
---|---|
500 | Internal Server Error |
501 | Not Implemented |
502 | Bad Gateway |
503 | Service Unavailable |
504 | Gateway Timeout |
Summary
Using HTTP status codes correctly in a RESTful service is useful and provides consistency across all API implementations.
Further information on HTTP status codes can be found at the following link: