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

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.

主站蜘蛛池模板: 沙湾县| 任丘市| 微山县| 米易县| 分宜县| 自治县| 龙里县| 鄂伦春自治旗| 万荣县| 江阴市| 葵青区| 靖宇县| 营山县| 苍溪县| 都匀市| 平陆县| 固原市| 南川市| 连城县| 三河市| 岱山县| 松潘县| 兴海县| 偏关县| 常山县| 千阳县| 迁西县| 固镇县| 舞钢市| 忻州市| 湟中县| 湖州市| 长沙县| 南宫市| 阜宁县| 威信县| 舒城县| 辽阳县| 手游| 岗巴县| 烟台市|