- Building RESTful Web Services with PHP 7
- Haafiz Waheed ud din Ahmad
- 96字
- 2021-07-03 00:02:20
Reading a comment
- Request: GET /posts/1/comment/1 HTTP/1.1 or GET /comment/1 HTTP/1.1
The second one seems more reasonable as in that one only needs to have a comment's ID without worrying about the post ID of that comment. And since a comment's ID is unique, we don't need to have the post's ID to get the comment. So, we will proceed with the second URL that is GET /comment/1 HTTP/1.1.
- Response:
{id:1, post_id:1, comment:"An Awesome Post", link: "/comments/1"}
- Response code: 200 OK
Since any comment can only exist against some post, the response includes post_id as well.
推薦閱讀
- 在最好的年紀學Python:小學生趣味編程
- JMeter 性能測試實戰(zhàn)(第2版)
- Python王者歸來
- C/C++常用算法手冊(第3版)
- Getting Started with Laravel 4
- ASP.NET Core 2 Fundamentals
- 區(qū)塊鏈底層設計Java實戰(zhàn)
- Mastering Backbone.js
- 小程序,巧應用:微信小程序開發(fā)實戰(zhàn)(第2版)
- HTML+CSS+JavaScript網(wǎng)頁設計從入門到精通 (清華社"視頻大講堂"大系·網(wǎng)絡開發(fā)視頻大講堂)
- 代替VBA!用Python輕松實現(xiàn)Excel編程
- Django 5企業(yè)級Web應用開發(fā)實戰(zhàn)(視頻教學版)
- 邊玩邊學Scratch3.0少兒趣味編程
- Learning Bootstrap 4(Second Edition)
- Python趣味創(chuàng)意編程