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

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.

主站蜘蛛池模板: 济源市| 南宁市| 高州市| 怀柔区| 新民市| 水城县| 三门峡市| 勃利县| 城市| 临武县| 天峻县| 禹城市| 静海县| 南靖县| 扎囊县| 五华县| 玛纳斯县| 宜都市| 互助| 荣昌县| 大安市| 三原县| 平泉县| 遂平县| 宜宾市| 会理县| 平谷区| 文水县| 微山县| 南投县| 同心县| 新乐市| 屏东县| 疏勒县| 尖扎县| 洛川县| 澄城县| 通海县| 石家庄市| 汽车| 海阳市|