- 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.
- Cisco OSPF命令與配置手冊
- 物聯(lián)網(wǎng)短距離無線通信技術(shù)應(yīng)用與開發(fā)
- EDA技術(shù)與VHDL編程
- Twilio Cookbook
- Building Django 2.0 Web Applications
- SEO 20日
- Truffle Quick Start Guide
- 互聯(lián)網(wǎng)安全的40個智慧洞見:2015年中國互聯(lián)網(wǎng)安全大會文集
- 企業(yè)私有云建設(shè)指南
- 網(wǎng)絡(luò)安全技術(shù)與解決方案(修訂版)
- 中小型局域網(wǎng)組建、管理與維護實戰(zhàn)
- Wireshark網(wǎng)絡(luò)分析就這么簡單
- Learning Storm
- 轉(zhuǎn)化:提升網(wǎng)站流量和轉(zhuǎn)化率的技巧
- Dart Cookbook