跳转到内容

更新 Worker 任务

方法: PUT

端点: /api/v2/worker-tasks/{workerTaskId}

认证: 支持 Authorization: Bearer <YOUR_API_KEY>api-key: <YOUR_API_KEY>?token=<YOUR_API_KEY>。推荐优先使用 Bearer token。

PUT/api/v2/worker-tasks/{workerTaskId}Update worker task
AuthenticationRequired

Stored only in this browser tab. Sent only to https://openapi.coreclaw.com.

Parameters
path · stringRequired

Saved Worker task template slug. Get it from the `data.list[].slug` field of `GET /api/v2/worker-tasks`. The playground prefills a sample slug; replace it with your own.

Request BodyRequiredapplication/json
FieldTypeRequiredDescription
descriptionstringOptionalTask description. Omit to keep current description.
schedule_dayintegerOptionalDay of month for monthly schedule (1-31). Constraints: range 1-31.
schedule_enabledenum: 0, 1OptionalSchedule switch. 0=disabled, 1=enabled. Constraints: allowed values: `0`, `1`.
schedule_once_datestringOptionalOnce schedule date in YYYY-MM-DD.
schedule_timestringOptionalSchedule time in HH:mm.
schedule_typeenum: 1, 2, 3, 4OptionalSchedule type. 1=daily, 2=weekly, 3=monthly, 4=once. Constraints: allowed values: `1`, `2`, `3`, `4`.
schedule_weekdayenum: 1, 2, 3, 4, 5, 6, 7OptionalWeekday for weekly schedule. 1=Monday ... 7=Sunday. Constraints: range 1-7; allowed values: `1`, `2`, `3`, `4`, `5`, `6`, `7`.
titlestringOptionalTask title. Omit to keep current title.
Request body (JSON)

用于更新任务模板的标题、描述或调度配置;省略的字段保持原值。

  • workerTaskId 是已保存任务模板的 slug。
参数必填类型说明
workerTaskIdstring已保存 Worker 任务模板的 slug,可从 GET /api/v2/worker-tasks 响应的 data.list[].slug 获取。

使用 Content-Type: application/json 发送请求体。表格中的必填/选填描述字段本身是否必须提供;整个请求体是否必填以在线试用区的 Request Body 标记为准。

字段必填类型说明
descriptionstring任务模板描述,可选。
schedule_dayinteger每月调度时的日期(1-31)。
schedule_enabledenum: 0, 1调度开关:1 启用,0 关闭。
schedule_once_datestring单次调度的日期,格式 YYYY-MM-DD
schedule_timestring调度执行时间,格式 HH:mm
schedule_typeenum: 1, 2, 3, 4调度类型:1=每天,2=每周,3=每月,4=单次。
schedule_weekdayenum: 1, 2, 3, 4, 5, 6, 7每周调度时的星期几(1=周一 … 7=周日)。
titlestring任务模板标题,用于展示和搜索。
{
"description": "Scrape Google Maps business records on a schedule.",
"schedule_day": 1,
"schedule_enabled": 0,
"schedule_once_date": "2026-08-01",
"schedule_time": "09:00",
"schedule_type": 1,
"schedule_weekday": 1,
"title": "Google Maps Scraper (Task)"
}
Terminal window
curl -X PUT "https://openapi.coreclaw.com/api/v2/worker-tasks/YOUR_WORKER_TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
--data '{"description":"Scrape Google Maps business records on a schedule.","schedule_day":1,"schedule_enabled":0,"schedule_once_date":"2026-08-01","schedule_time":"09:00","schedule_type":1,"schedule_weekday":1,"title":"Google Maps Scraper (Task)"}'
{
"code": 0,
"message": "success",
"request_id": "req-123"
}
  • API v2 同时支持 Bearer token、旧版 api-key 请求头和 query token;新集成建议优先使用 Bearer token。
  • PUT 为部分更新语义:省略的字段保持原值,无需重传整个任务对象。
  • 如需更新任务输入参数本身(而非标题或调度),请使用 PUT /api/v2/worker-tasks/{workerTaskId}/input
HTTP 状态应用代码含义
2000请求成功。
40011000请求参数不合法。
40112001认证缺失或无效。
40411004目标资源不存在。
42211000请求语义或字段校验未通过。
42913000请求过于频繁。
50010000服务端内部错误。