- Building Microservices with Go
- Nic Jackson
- 100字
- 2021-07-15 17:28:08
PATCH
The PATCH verb is used to perform a partial update, for example, if we only wanted to update the name of our cat we could make a PATCH request only containing the details that we would like to change.
Request:
PATCH /v1/cats/12343 HTTP/1.1
Content-Type: application/json
Content-Length: xxxx
{"weight": 9}
Response:
HTTP/1.1 204 No Body
Content-Type: application/json
Content-Length: 0
In my experience PATCH updates are rarely used, the general convention is to use a PUT and to update the whole object, this not only makes the code easier to write but also makes an API which is simpler to understand.
推薦閱讀
- 大學計算機基礎(第二版)
- Visual Basic程序設計教程
- C語言程序設計(第2版)
- Data Analysis with Stata
- Oracle BAM 11gR1 Handbook
- Visual FoxPro程序設計習題集及實驗指導(第四版)
- 低代碼平臺開發實踐:基于React
- Yii Project Blueprints
- 單片機原理及應用技術
- AMP:Building Accelerated Mobile Pages
- Python面試通關寶典
- 3D Printing Designs:Design an SD Card Holder
- Python實戰指南:手把手教你掌握300個精彩案例
- Learning Unity Physics
- TensorFlow程序設計