- 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.
推薦閱讀
- Java多線程編程實(shí)戰(zhàn)指南:設(shè)計(jì)模式篇(第2版)
- WebAssembly實(shí)戰(zhàn)
- Mastering Selenium WebDriver
- Python Deep Learning
- Unity&VR游戲美術(shù)設(shè)計(jì)實(shí)戰(zhàn)
- Oracle Data Guard 11gR2 Administration Beginner's Guide
- 遠(yuǎn)方:兩位持續(xù)創(chuàng)業(yè)者的點(diǎn)滴思考
- UML軟件建模
- Learning Concurrency in Python
- 程序員的成長(zhǎng)課
- 嵌入式C編程實(shí)戰(zhàn)
- Responsive Web Design with jQuery
- Apache Solr for Indexing Data
- Google Maps JavaScript API Cookbook
- C語(yǔ)言程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo)與習(xí)題精解