- Building RESTful Web Services with PHP 7
- Haafiz Waheed ud din Ahmad
- 176字
- 2021-07-03 00:02:17
Update operation
There can be two types of update operations:
- Update some attributes of a particular record
- Replace that particular record completely with a new one
Only thing that change to perform these two operations: HTTP method.
With the Update operation, to update some of attributes of the resource use:
HTTP method: PATCH
While to replace the whole resource use:
HTTP method: PUT
The URI and the parameters will remain the same:
URI: /{resource}/{resource_id}
Parameters: There can be multiple parameters in a query string. Initially, people try to pass these parameters in the body but actually, the PATCH and PUT parameters are passed using a query string.
Result: This should update or replace the resource based on the HTTP method.
Here, resource_id will be the ID of the resource which can be found from the List operation's result. Again, practically using PATCH or PUT will not make any difference but based on REST standards PATCH should be used for updating the different attributes of a record while PUT should be used for replacing the whole resource.
- Advanced Quantitative Finance with C++
- Cocos2D-X權威指南(第2版)
- Java EE 6 企業級應用開發教程
- Reactive Programming with Swift
- 深入實踐Spring Boot
- Hands-On JavaScript High Performance
- Instant QlikView 11 Application Development
- Building Minecraft Server Modifications
- 前端HTML+CSS修煉之道(視頻同步+直播)
- 自學Python:編程基礎、科學計算及數據分析(第2版)
- Visual C++程序設計全程指南
- Parallel Programming with Python
- Implementing Splunk(Second Edition)
- JavaScript程序設計基礎教程(慕課版)
- Prezi Cookbook