跳转到主要内容

介绍

Publisher Tasks API 用于查询发布任务的执行状态。每个通过 Publish API 创建的任务都可以通过 Tasks API 跟踪其进度,获取发布结果和已发布的 URL。

基本用法

查询单个任务

curl -X POST 'https://api.acedata.cloud/publisher/tasks' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "action": "retrieve",
    "id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890"
  }'

响应示例

{
  "id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
  "request": {
    "title": "Introduction to AI APIs",
    "content": "# Introduction...",
    "channel": "zhihu"
  },
  "response": {
    "success": true,
    "task_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
    "channel": "zhihu",
    "state": "completed",
    "url": "https://zhuanlan.zhihu.com/p/123456789"
  },
  "created_at": 1705312200.0,
  "started_at": 1705312205.0,
  "finished_at": 1705312260.0
}

批量查询任务

curl -X POST 'https://api.acedata.cloud/publisher/tasks' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "action": "retrieve_batch",
    "ids": [
      "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
      "a9b8c7d6-e5f4-3210-abcd-ef1234567890"
    ]
  }'

任务状态说明

状态说明
pending任务已创建,等待执行
running任务正在执行中
completed任务已完成,可获取发布的 URL
failed任务执行失败,可查看错误信息

注意事项

  • 任务查询为免费操作,不消耗积分
  • 任务结果会保留 30 天
  • 建议在提交发布任务后定期轮询任务状态