跳转到主要内容

接口

POST http://localhost:8080/api/v1/tasks/{id}/resume

描述

恢复之前通过暂停接口暂停的任务。工作流会从上一次检查点继续执行。

认证

必需:是 在请求头中携带 API Key:
X-API-Key: sk_test_123456

请求

请求头

Header必需说明
X-API-KeyAPI 鉴权 Key
Content-Type发送 body 时为 application/json
traceparentW3C Trace 上下文

路径参数

参数类型必需说明
idstring任务 ID(Temporal workflow ID)

Body 参数

参数类型必需说明
reasonstring恢复原因(备注)

请求示例

{
  "reason": "用户确认继续执行"
}

响应

202 Accepted

{
  "success": true,
  "message": "Resume signal sent",
  "task_id": "task-123"
}

404 Not Found

{ "error": "Task not found" }

409 Failed Precondition

无法恢复处于无效状态的任务:
{ "error": "cannot resume completed task" }
{ "error": "cannot resume failed task" }
{ "error": "cannot resume cancelled task" }
{ "error": "cannot resume timed out task" }
{ "error": "task is not paused" }

401 / 403

{ "error": "Unauthorized" }
{ "error": "Forbidden" }

说明

  • 仅对当前处于暂停状态的任务有效;对未暂停的任务调用会返回 409 Failed Precondition 错误。
  • 状态验证确保对无效操作(如恢复已完成或正在运行的任务)返回清晰的错误消息。
  • SSE 流在恢复时会发送 workflow.resumed 事件。