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

Updating blog post

  • Request: PATCH /posts/1?title=Modified%20Post HTTP/1.1
  • Response:
{id:1, title:"Modified Post", content:"This is an awesome post", link:"posts/1" }
  • Response code: 200 OK

Note, if a blog post with the ID provided (that is 1 in this case) does not exist, it should return the response code 404 that means resource not found.

Also, we have used PATCH instead of PUT for the update since PATCH is used to modify all or some attributes of a record while PUT is used for modifying a whole record just like replacing an old record with a new one. So, if we use PUT and pass only one attribute, the other attributes will become empty. In the case of PATCH, it will only update the attribute that is passed and other attributes remain untouched.

主站蜘蛛池模板: 涞源县| 孝昌县| 新巴尔虎左旗| 邵东县| 利津县| 阜城县| 东兰县| 万州区| 建昌县| 涪陵区| 股票| 马山县| 尉犁县| 钟祥市| 如皋市| 凌云县| 邢台县| 淮南市| 枝江市| 聂荣县| 明溪县| 崇礼县| 法库县| 京山县| 华容县| 蓬安县| 九龙县| 噶尔县| 澄江县| 从江县| 青海省| 离岛区| 建湖县| 铁岭市| 贡嘎县| 临沂市| 恩平市| 竹溪县| 赤峰市| 隆安县| 沭阳县|