- Python API Development Fundamentals
- Jack Chan Ray Chung Jack Huang
- 250字
- 2021-06-11 12:56:23
HTTP Status Codes
An HTTP status code is a code that is returned in the HTTP protocol. It is usually hidden from users, so you probably didn't realize it exists. In fact, every HTTP response from the server contains a status code. And as we construct our RESTful API, we need to comply with the HTTP protocol. The status code helps the frontend client understand the status of their request, that is, whether it is a success or failure. For example, there could be a client request about creating a record in the backend database. In that case, once the database record has been successfully created, the server should return an HTTP status code 201 (Created). If there is an error (such as a syntax error in the JSON document), the server should return an HTTP status code 400 (Bad Request) instead.
Commonly used HTTP Status Codes
Let's discuss some commonly used status codes. They are as follows:
- 200 OK means the request has been successful. The request could be a GET, PUT, or PATCH.
- 201 Created means the POST request has been successful and a record has been created.
- 204 No Content means the DELETE request has been successful.
- 400 Bad Request means there is something wrong with the client request. For example, there is a syntax error in the JSON format.
- 401 Unauthorized means the client request is missing authentication details.
- 403 Forbidden means the requested resource is forbidden.
- 404 Not Found means the requested resource doesn't exist.
- 智慧城市:大數(shù)據(jù)、互聯(lián)網(wǎng)時(shí)代的城市治理(第4版)
- Cisco OSPF命令與配置手冊(cè)
- Building E-commerce Sites with VirtueMart Cookbook
- C++黑客編程揭秘與防范
- Building Django 2.0 Web Applications
- Hands-On Chatbot Development with Alexa Skills and Amazon Lex
- 局域網(wǎng)組建、管理與維護(hù)項(xiàng)目教程(Windows Server 2003)
- Windows Server 2003 Active Directory Design and Implementation: Creating, Migrating, and Merging Networks
- Getting Started with WebRTC
- Getting Started with Grunt:The JavaScript Task Runner
- 城域網(wǎng)與廣域網(wǎng)(第2版)
- Building Web Applications with ArcGIS
- React Cookbook
- Scala Design Patterns.
- AIoT應(yīng)用開發(fā)與實(shí)踐