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

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.

主站蜘蛛池模板: 凌海市| 五华县| 襄樊市| 和田县| 方城县| 新安县| 古丈县| 鄂州市| 肥东县| 射阳县| 阳高县| 浠水县| 喀喇| 鄄城县| 广灵县| 万年县| 定州市| 望谟县| 卢氏县| 邵武市| 西平县| 太湖县| 罗定市| 天镇县| 闻喜县| 桂东县| 青海省| 邳州市| 开江县| 贵州省| 红河县| 婺源县| 金华市| 台北市| 广西| 甘洛县| 宜良县| 赤壁市| 牙克石市| 藁城市| 湄潭县|