API 参考 任务

创建任务

POST/projects/{project_id}/tasks/

创建任务实例并派发到项目沙箱。

参数

请求体字段必填说明
name必填看板上的显示名
task_type_id二选一要运行的元任务 UUID
task_type_identifier二选一元任务标识——与 task_type_id 二选一,不可同时提供
params可选匹配元任务参数 schema 的值(默认 {})
workspace_id / workspace_slug可选在指定工作区运行,而非元任务默认值
show_in_kanban可选false 时不显示在看板(默认 true)
auto_start可选false 时仅创建为 pending,不派发(默认 true)

请求

curl -X POST "$ALLYBUILD_API_URL/projects/$PROJECT_ID/tasks/" \
  -H "Authorization: Bearer $TASK_JWT" \
  -H "Content-Type: application/json"
  -d '{
    "name": "weekly-report",
    "task_type_identifier": "weekly-report",
    "params": {"month": "2026-10"}
  }'

响应

{
  "id": "9a2b8c7d-1e2f-4a5b-8c9d-0e1f2a3b4c5d",
  "name": "weekly-report",
  "task_type_id": "5f4e3d2c-...",
  "params": {"month": "2026-10"},
  "status": "pending",
  "current_phase": null,
  "progress": 0,
  "created_at": "2026-10-01T12:00:00Z",
  "started_at": null,
  "finished_at": null,
  "dependencies": [],
  "error_message": null,
  "pr_url": null
}