取消构建
OpenAPI 契约
- 方法
- POST
- 路径
/api/v1/builds/{taskId}/cancel- 认证
- jwtBearer (bearer) OR automationKey (bearer)
- 响应状态
- 200 400 401 403 404 429 500
请求与响应 Schema
JSON
{
"requestBody": {},
"responses": {
"200": {
"description": "Build cancelled",
"content": {
"application/json": {
"$ref": "#/components/schemas/CompileTaskResponse"
}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/json": {
"$ref": "#/components/schemas/RequestError"
}
}
},
"401": {
"description": "Authentication required or invalid",
"content": {
"application/json": {
"$ref": "#/components/schemas/SecurityError"
}
}
},
"403": {
"description": "Authenticated but not permitted",
"content": {
"application/json": {
"$ref": "#/components/schemas/SecurityError"
}
}
},
"404": {
"description": "Requested build was not found",
"content": {
"application/json": {
"$ref": "#/components/schemas/ApiError"
}
}
},
"429": {
"description": "HTTP rate limit or API-key NCU usage limit exceeded",
"content": {
"application/json": {
"$ref": "#/components/schemas/RateLimitError"
}
}
},
"500": {
"description": "Unexpected server error",
"content": {
"application/json": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}使用 JWT 或带 build:write 的 nfy_ 密钥请求取消待处理或运行中的构建。project task 还要求调用方对项目拥有有效 build:write capability;legacy 或 ad-hoc task 使用 exact-owner fallback。服务会将其标记为已取消、尝试终止活跃编译器进程并结算计费。已完成、失败或已经取消的任务不能再次取消。
将取消视为会改变状态的 POST,而不是幂等重试目标。读取返回的任务,并在必要时轮询到工作线程停止后再尝试删除。托管获取始终需要认证并通过任务/资源授权,并且仅在任务成功且输出仍被存储时可用。