- Building RESTful Web Services with PHP 7
- Haafiz Waheed ud din Ahmad
- 125字
- 2021-07-03 00:02:19
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.
推薦閱讀
- C語言程序設(shè)計(jì)案例教程
- Learning Single:page Web Application Development
- LabVIEW入門與實(shí)戰(zhàn)開發(fā)100例
- FreeSWITCH 1.6 Cookbook
- Python進(jìn)階編程:編寫更高效、優(yōu)雅的Python代碼
- DevOps Automation Cookbook
- Java:Data Science Made Easy
- Getting Started with Gulp
- Visualforce Developer’s guide
- INSTANT Yii 1.1 Application Development Starter
- 邊玩邊學(xué)Scratch3.0少兒趣味編程
- C++面向?qū)ο蟪绦蛟O(shè)計(jì)
- Backbone.js Patterns and Best Practices
- 程序員的英語
- HTML5 Game Development by Example:Beginner's Guide(Second Edition)