收藏接口
管理用户收藏的 CRUD 操作接口。
GET
/bookmarks获取当前用户的收藏列表。
查询参数
| 参数 | 类型 | 说明 |
|---|---|---|
| page | integer | 页码,默认 1 |
| per_page | integer | 每页数量,默认 20,最大 100 |
| tag | string | 按标签筛选 |
| folder_id | string | 按文件夹筛选 |
| q | string | 搜索关键词 |
响应示例
{
"data": [
{
"id": "bk_abc123",
"url": "https://example.com",
"title": "Example Page",
"description": "An example page",
"tags": ["example", "test"],
"folder_id": null,
"is_cached": true,
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}
],
"meta": {
"current_page": 1,
"per_page": 20,
"total": 42,
"total_pages": 3
}
}POST
/bookmarks创建新收藏。
请求体
{
"url": "https://example.com", // 必填
"title": "Example Page", // 可选,不填自动解析
"description": "Page description", // 可选
"tags": ["tag1", "tag2"], // 可选
"folder_id": "folder_abc", // 可选
"cache_immediately": true // 可选,是否立即缓存
}响应示例
{
"id": "bk_xyz789",
"url": "https://example.com",
"title": "Example Page",
"description": "Page description",
"cover_image": "https://example.com/og-image.jpg",
"tags": ["tag1", "tag2"],
"folder_id": "folder_abc",
"is_cached": false,
"cache_status": "pending",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z"
}GET
/bookmarks/:id获取收藏详情。
PUT
/bookmarks/:id更新收藏信息。
DELETE
/bookmarks/:id删除收藏(移至回收站)。
POST
/bookmarks/batch批量操作收藏。
支持的操作
- delete - 批量删除
- move - 批量移动到文件夹
- tag - 批量添加标签
- untag - 批量移除标签