返回首页
API 文档
Content Analyzer API 接口说明
POST
/api/content创建内容
上传新内容到系统
请求体
{
"source": "twitter", // 必填:来源(twitter, xiaohongshu, linuxdo 等)
"url": "https://...", // 必填:原文链接(唯一)
"title": "标题", // 可选:标题
"summary": "内容摘要", // 必填:摘要(50-200字)
"content": "完整内容", // 必填:完整内容
"score": 8.5, // 必填:评分(0-10)
"analyzedBy": "OpenClaw Agent" // 可选:分析者名称
}响应
{
"id": "clxxx...",
"source": "twitter",
"url": "https://...",
"title": "标题",
"summary": "内容摘要",
"content": "完整内容",
"score": 8.5,
"analyzedBy": "OpenClaw Agent",
"analyzedAt": "2026-03-04T01:00:00.000Z",
"createdAt": "2026-03-04T01:00:00.000Z",
"updatedAt": "2026-03-04T01:00:00.000Z"
}示例(curl)
curl -X POST https://your-domain.vercel.app/api/content \
-H "Content-Type: application/json" \
-d '{
"source": "twitter",
"url": "https://twitter.com/user/status/123",
"title": "示例推文",
"summary": "这是一条示例推文的摘要",
"content": "这是完整的推文内容...",
"score": 8.5,
"analyzedBy": "OpenClaw Agent"
}'POST
/api/content/batch批量创建内容
一次上传多条内容(最多 100 条)
请求体(数组)
[
{
"source": "twitter",
"url": "https://twitter.com/user/status/123",
"title": "标题",
"summary": "摘要",
"content": "完整内容",
"score": 8.5,
"analyzedBy": "OpenClaw Agent"
},
{
"source": "xiaohongshu",
"url": "https://xiaohongshu.com/...",
"summary": "摘要",
"content": "完整内容",
"score": 7.0
}
]响应
{
"success": 2,
"failed": 0,
"total": 2,
"errors": [],
"created": [
{
"index": 0,
"id": "clxxx...",
"url": "https://twitter.com/user/status/123"
},
{
"index": 1,
"id": "clyyy...",
"url": "https://xiaohongshu.com/..."
}
]
}💡 使用提示
- 最大批量大小:100 条
- 部分失败不影响其他内容创建
- 返回详细的成功/失败统计
- 适合 OpenClaw Agent 批量上传
CLI 工具
# 本地上传 npm run upload -- --file data.json # 生产环境上传 npm run upload -- --file data.json --url https://your-domain.vercel.app # 查看帮助 npm run upload -- --help
GET
/api/content获取内容列表
获取所有内容,支持排序
查询参数
orderBy排序字段(score, createdAt, analyzedAt),默认 score
示例
curl https://your-domain.vercel.app/api/content?orderBy=score
GET
/api/content/[id]获取内容详情
根据 ID 获取单个内容的完整信息
示例
curl https://your-domain.vercel.app/api/content/clxxx...
DELETE
/api/content/[id]删除内容
根据 ID 删除内容
响应
{
"success": true
}示例
curl -X DELETE https://your-domain.vercel.app/api/content/clxxx...
GET
/api/stats获取统计信息
获取内容统计数据
响应
{
"total": 30,
"bySource": {
"twitter": 10,
"xiaohongshu": 10,
"linuxdo": 10
}
}错误响应
400 Bad Request
{
"error": "Missing required fields: source, url, summary, content, score"
}404 Not Found
{
"error": "Content not found"
}500 Internal Server Error
{
"error": "Failed to create content"
}