通知 API
带已读状态的用户通知(提及、点赞、关注、系统和订单消息)。内存中的固定数据:写入会保留到应用重启为止。
- GET
https://api.testingapis.com/api/NotificationsList notifications with filtering, sorting, search and pagination. - GET
https://api.testingapis.com/api/Notifications/{id}Get a notification by ID. - PUT
https://api.testingapis.com/api/Notifications/{id}/readMark a notification as read. - PUT
https://api.testingapis.com/api/Notifications/read-allMark all notifications as read, for one user or for everyone.
请求示例
List notifications with filtering, sorting, search and pagination. 完整参考和 Send 按钮(英文).
cURL
curl -X GET "https://api.testingapis.com/api/Notifications?limit=2"响应 · 200 OK
[
{
"id": 1,
"userId": 101,
"type": "mention",
"title": "You were mentioned in a comment",
"body": "Liam mentioned you in 'API Design Patterns'",
"read": false,
"link": "/posts/3",
"createdAt": "2025-07-17T08:30:00Z"
},
{
… (3 more lines)筛选、排序与分页
列表端点接受 limit、page、offset、sort、order 和 q,任何字段名都可用作精确筛选。总数通过 X-Total-Count 响应头返回。写入的数据在服务器重启前都保存在内存中,所以测试可以随意创建、修改和删除记录。 查询参数参考.