- 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.
推薦閱讀
- Learning Spring 5.0
- Linux C/C++服務(wù)器開發(fā)實(shí)踐
- Instant Typeahead.js
- Python高級(jí)機(jī)器學(xué)習(xí)
- 編寫高質(zhì)量代碼:改善C程序代碼的125個(gè)建議
- Visual C++串口通信技術(shù)詳解(第2版)
- Building Mapping Applications with QGIS
- Web Application Development with MEAN
- SAS數(shù)據(jù)統(tǒng)計(jì)分析與編程實(shí)踐
- ASP.NET Core 2 Fundamentals
- 時(shí)空數(shù)據(jù)建模及其應(yīng)用
- Photoshop智能手機(jī)APP界面設(shè)計(jì)
- 黑莓(BlackBerry)開發(fā)從入門到精通
- Laravel Design Patterns and Best Practices
- Elasticsearch搜索引擎構(gòu)建入門與實(shí)戰(zhàn)