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

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.

主站蜘蛛池模板: 武义县| 林芝县| 宣汉县| 崇仁县| 岳普湖县| 潢川县| 峨山| 永新县| 宜阳县| 侯马市| 龙门县| 龙泉市| 海口市| 安西县| 丽江市| 巴塘县| 渝北区| 莲花县| 漳平市| 疏附县| 滁州市| 永泰县| 洪湖市| 肇东市| 仁怀市| 新津县| 延吉市| 穆棱市| 克山县| 乐陵市| 宿州市| 酉阳| 从江县| 方正县| 西平县| 灯塔市| 息烽县| 河曲县| 杨浦区| 旺苍县| 恭城|