上QQ阅读APP看书,第一时间看更新
Status codes
When a server returns responses, it includes status codes. These status codes inform the client how the request performed on the server. As a developer, you do not need to know every status code (there are many of them), but you should know the most common ones and how they are used:
Some status codes are (by default) expected from the server for the following HTTP verbs:
- GET: Returns 200 OK
- POST: Returns 201 CREATED
- PUT: Returns 200 OK
- DELETE: Returns 204 NO CONTENT if the operation failed
We already saw how API returned 200 OK for the GET request. As we move forward with other verbs, we will explore the responses returned with the codes mentioned previously.