帖子 API
由用户 101-110 撰写的博客帖子,带标签、点赞和嵌套评论。内存中的固定数据:写入会保留到应用重启为止。
免费:这些端点无需账号。
- GET
https://api.testingapis.com/api/PostsList posts with filtering, sorting, search and pagination. - POST
https://api.testingapis.com/api/PostsCreate a post. - GET
https://api.testingapis.com/api/Posts/{id}Get a post by ID. - PUT
https://api.testingapis.com/api/Posts/{id}Update a post. - DELETE
https://api.testingapis.com/api/Posts/{id}Delete a post. - GET
https://api.testingapis.com/api/Posts/{id}/commentsList the comments on a post. - GET
https://api.testingapis.com/api/Posts/user/{userId}List the posts written by a user.
请求示例
List posts with filtering, sorting, search and pagination. 完整参考和 Send 按钮(英文).
cURL
curl -X GET "https://api.testingapis.com/api/Posts?limit=2"响应 · 200 OK
[
{
"id": 1,
"userId": 101,
"title": "Getting Started with REST APIs",
"body": "REST APIs are the backbone of modern web applications. In this post, we'll cover the basics of HTTP methods, status codes, and request/re…
"tags": ["api", "tutorial", "beginner"],
"publishedAt": "2025-07-01T14:00:00Z",
"likes": 42
},
{
"id: 2,
… (3 more lines)筛选、排序与分页
列表端点接受 limit、page、offset、sort、order 和 q,任何字段名都可用作精确筛选。总数通过 X-Total-Count 响应头返回。写入的数据在服务器重启前都保存在内存中,所以测试可以随意创建、修改和删除记录。 查询参数参考.