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

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.

主站蜘蛛池模板: 启东市| 涟源市| 利川市| 铜梁县| 上饶市| 冀州市| 和田县| 车致| 孟津县| 民勤县| 南开区| 承德县| 资中县| 托克逊县| 洱源县| 旬邑县| 广元市| 开封市| 阳原县| 萨迦县| 崇左市| 资中县| 和龙市| 敦化市| 镇雄县| 延长县| 望江县| 鹿泉市| 宝兴县| 辽阳市| 宁南县| 通州区| 古蔺县| 晋城| 临湘市| 任丘市| 新昌县| 广南县| 调兵山市| 丹江口市| 海安县|