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中英文标题
  • slugURL 标识符(唯一)
  • category分类(news/industry)
  • contentZh / contentEn中英文内容
  • excerptZh / excerptEn中英文摘要
  • coverImage封面图 URL
  • tags标签数组
  • published是否发布