- Building RESTful Web Services with PHP 7
- Haafiz Waheed ud din Ahmad
- 50字
- 2021-07-03 00:02:20
Creating the post's comment
- Request: POST /posts/1/comments HTTP/1.1
- Body parameters: comment: An Awesome Post
- Response:
{id:1, post_id:1, comment:"An Awesome Post", link: "/comments/1"}
- Response code: 201 Created
Here in the case of a comment, a comment is created against a certain blog post. So, the request URL includes post_id as well.
推薦閱讀