72 lines
2.4 KiB
JSON
72 lines
2.4 KiB
JSON
|
|
{
|
|||
|
|
"openapi": "3.0.3",
|
|||
|
|
"info": {
|
|||
|
|
"title": "Holy蟹业务任务接口",
|
|||
|
|
"version": "1.1.0",
|
|||
|
|
"description": "前端调用的业务后端任务接口。继续采集沿用原任务 ID;重新采集创建新任务。"
|
|||
|
|
},
|
|||
|
|
"servers": [
|
|||
|
|
{
|
|||
|
|
"url": "http://127.0.0.1:8000",
|
|||
|
|
"description": "本地业务后端,请在 Apifox 环境中改成实际地址"
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"paths": {
|
|||
|
|
"/api/v1/tasks/{task_id}/cancel": {
|
|||
|
|
"post": {
|
|||
|
|
"summary": "停止任务",
|
|||
|
|
"tags": ["问一问任务控制"],
|
|||
|
|
"parameters": [{"$ref": "#/components/parameters/TaskId"}],
|
|||
|
|
"requestBody": {
|
|||
|
|
"required": false,
|
|||
|
|
"content": {
|
|||
|
|
"application/json": {
|
|||
|
|
"schema": {"type": "object", "properties": {"reason": {"type": "string"}}},
|
|||
|
|
"example": {"reason": "用户主动取消"}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
"responses": {"200": {"description": "停止请求成功"}}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
"/api/v1/tasks/{task_id}/retry": {
|
|||
|
|
"post": {
|
|||
|
|
"summary": "继续采集(兼容路径)",
|
|||
|
|
"description": "沿用业务任务 ID 和爬虫任务 ID,从 framework 检查点继续。",
|
|||
|
|
"tags": ["问一问任务控制"],
|
|||
|
|
"parameters": [{"$ref": "#/components/parameters/TaskId"}],
|
|||
|
|
"responses": {"200": {"description": "恢复成功"}}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
"/api/v1/tasks/{task_id}/resume": {
|
|||
|
|
"post": {
|
|||
|
|
"summary": "继续采集",
|
|||
|
|
"description": "沿用业务任务 ID 和爬虫任务 ID,从 framework 检查点继续。",
|
|||
|
|
"tags": ["问一问任务控制"],
|
|||
|
|
"parameters": [{"$ref": "#/components/parameters/TaskId"}],
|
|||
|
|
"responses": {"200": {"description": "恢复成功"}}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
"/api/v1/tasks/{task_id}/recollect": {
|
|||
|
|
"post": {
|
|||
|
|
"summary": "重新全量采集",
|
|||
|
|
"description": "复制原任务配置,创建新的业务任务 ID 和爬虫任务 ID,从头执行。",
|
|||
|
|
"tags": ["问一问任务控制"],
|
|||
|
|
"parameters": [{"$ref": "#/components/parameters/TaskId"}],
|
|||
|
|
"responses": {"201": {"description": "新任务创建成功"}}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
"components": {
|
|||
|
|
"parameters": {
|
|||
|
|
"TaskId": {
|
|||
|
|
"name": "task_id",
|
|||
|
|
"in": "path",
|
|||
|
|
"required": true,
|
|||
|
|
"description": "Holy蟹业务任务 ID,例如 HC-20260723-ABCDE",
|
|||
|
|
"schema": {"type": "string"}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|