官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 北辰区| 桂林市| 辽源市| 理塘县| 嘉鱼县| 安溪县| 探索| 全椒县| 太湖县| 芒康县| 蒙阴县| 尚志市| 洛南县| 孟州市| 崇文区| 浦城县| 波密县| 宁波市| 咸阳市| 政和县| 雅安市| 方山县| 独山县| 玉龙| 宁国市| 马关县| 通道| 永和县| 涟水县| 怀宁县| 龙泉市| 井冈山市| 大理市| 开鲁县| 稷山县| 迁安市| 城市| 海南省| 鲁甸县| 新宁县| 信阳市|