任务
创建任务
POST /external/v1/projects/{project_id}/tasks请求体(JSON):
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
task_type_identifier | string | 是 | 元任务的 identifier 字段 |
params | object | 否 | 任务参数,默认 {} |
name | string | 否 | 任务名称;默认 {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查询参数:
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
status | string | 无 | 按状态过滤 |
limit | integer | 50 | 最多返回条数(最大 200) |
offset | integer | 0 | 分页偏移 |
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
}