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

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.

主站蜘蛛池模板: 页游| 隆尧县| 大石桥市| 岳普湖县| 阿克苏市| 随州市| 海阳市| 安吉县| 辽源市| 科技| 信宜市| 永修县| 扎鲁特旗| 红原县| 外汇| 凤凰县| 稷山县| 公安县| 叙永县| 永安市| 若羌县| 湘乡市| 威信县| 诸暨市| 高唐县| 广南县| 阳春市| 星座| 和平区| 平定县| 泰兴市| 西昌市| 江达县| 巴林左旗| 高雄县| 沙雅县| 若羌县| 平昌县| 太白县| 夹江县| 婺源县|