Skip to content

任务

创建任务

POST /external/v1/projects/{project_id}/tasks

请求体(JSON):

字段类型必填说明
task_type_identifierstring元任务的 identifier 字段
paramsobject任务参数,默认 {}
namestring任务名称;默认 {identifier}-{YYYYmmddHHMMSS}

示例:

bash
curl -X POST http://localhost:8000/external/v1/projects/PROJECT_ID/tasks \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task_type_identifier": "web-scraper",
    "params": { "url": "https://example.com", "depth": 2 },
    "name": "my-scrape-job"
  }'

响应(201):

json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "my-scrape-job",
  "status": "pending",
  "progress": 0,
  "current_phase": null,
  "task_type": "web-scraper",
  "created_at": "2026-08-21T08:00:00Z",
  "started_at": null,
  "finished_at": null,
  "error_message": null
}

列出任务

GET /external/v1/projects/{project_id}/tasks

查询参数:

参数类型默认值说明
statusstring按状态过滤
limitinteger50最多返回条数(最大 200)
offsetinteger0分页偏移
bash
curl "http://localhost:8000/external/v1/projects/PROJECT_ID/tasks?status=running&limit=10" \
  -H "Authorization: Bearer API_KEY"

响应(200): 任务数组,字段同上。


获取任务详情

GET /external/v1/projects/{project_id}/tasks/{task_id}
bash
curl http://localhost:8000/external/v1/projects/PROJECT_ID/tasks/TASK_ID \
  -H "Authorization: Bearer API_KEY"

响应(200):

json
{
  "id": "550e8400-...",
  "name": "my-scrape-job",
  "status": "success",
  "progress": 100,
  "current_phase": null,
  "task_type": "web-scraper",
  "params": { "url": "https://example.com", "depth": 2 },
  "result": { "pages_scraped": 14, "markdown": "..." },
  "created_at": "2026-08-21T08:00:00Z",
  "started_at": "2026-08-21T08:00:01Z",
  "finished_at": "2026-08-21T08:00:45Z",
  "error_message": null
}

Built with VitePress