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

Creating blog post

  • Request: POST /posts HTTP/1.1
  • Body parameters:

Content: This is an awesome post
Title: Awesome Post

  • Response:
{id:1, title:"Awesome Post", content:"This is an awesome post", link: "/posts/1" }
  • Response code: 201 Created

Here POST is the method, /posts is the URL (path after the server name) and HTTP 1.1 is the protocol. We will keep using the same way of mentioning requests in later examples as well. So, the first part of the request is the HTTP method, the second one is the URL and the third part is the protocol.

The response code tells the client that the resource has been created successfully. If a request parameter is missed by mistake, the response code should be 400, which represents a bad request.

主站蜘蛛池模板: 昂仁县| 沙坪坝区| 白河县| 安乡县| 贺兰县| 海城市| 明溪县| 昌都县| 米脂县| 博客| 宿迁市| 北票市| 河津市| 阳泉市| 斗六市| 南郑县| 彰化市| 湟源县| 华蓥市| 于田县| 佛学| 鲁甸县| 南岸区| 建宁县| 和龙市| 阳谷县| 双城市| 周至县| 监利县| 北票市| 玉山县| 贡山| 松潘县| 鹤壁市| 阿克陶县| 盐边县| 锡林郭勒盟| 新巴尔虎左旗| 太谷县| 奉新县| 陆河县|