- 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.
- Python科學計算(第2版)
- 微服務與事件驅動架構
- Learn Scala Programming
- C語言程序設計案例精粹
- Mastering Ext JS
- 網站構建技術
- Instant Lucene.NET
- Mastering C++ Multithreading
- Java EE企業(yè)級應用開發(fā)教程(Spring+Spring MVC+MyBatis)
- Access 2010數據庫應用技術實驗指導與習題選解(第2版)
- Advanced UFT 12 for Test Engineers Cookbook
- Mastering Apache Camel
- Neo4j 3.x入門經典
- C/C++代碼調試的藝術(第2版)
- jQuery Mobile Web Development Essentials(Second Edition)