Agent API 门户
Agent 操作端口已启用
外部 Agent 可以通过 API 管理文章、页面内容和系统设置。所有写操作需要 API Key 认证。
API 端点
文章管理
POST /api/agent/articles— 创建文章PUT /api/agent/articles/[slug]— 更新文章DELETE /api/agent/articles/[slug]— 删除文章
页面内容
POST /api/agent/page/[pageKey]— 更新页面内容
系统设置
PUT /api/agent/settings/[key]— 更新设置
认证方式
所有写操作需要在请求头中包含 API Key:
x-api-key: your_agent_api_key请求示例
// Create article
POST /api/agent/articles
Headers: x-api-key: fundao_agent_xxx
Body: {
"titleZh": "Article Title ZH",
"titleEn": "Article Title EN",
"slug": "article-slug",
"category": "news",
"contentZh": "Chinese content",
"contentEn": "English content",
"published": true
}
// Update page content
POST /api/agent/page/home
Headers: x-api-key: fundao_agent_xxx
Body: {
"lang": "zh",
"content": {
"hero": {
"title": "New Title",
"subtitle": "New Subtitle"
}
}
}数据模型
文章 (Article)
titleZh/titleEn— 中英文标题slug— URL 标识符(唯一)category— 分类(news/industry)contentZh/contentEn— 中英文内容excerptZh/excerptEn— 中英文摘要coverImage— 封面图 URLtags— 标签数组published— 是否发布