Skip to content
Get started

Create a worker schedule

$ handinger workers:schedules create
POST/api/workers/{workerId}/schedules

Schedule a worker instruction for a future or recurring run.

ParametersExpand Collapse
--worker-id: string

Worker id returned by the create worker endpoint.

--input: string
--when: object { date, type } or object { delayInSeconds, type } or object { cron, type } or object { intervalSeconds, type }
--budget: optional "low" or "standard" or "high" or "unlimited"
ReturnsExpand Collapse
worker_schedule: object { id, budget, input, 2 more } or object { id, budget, delayInSeconds, 3 more } or object { id, budget, cron, 3 more } or object { id, budget, input, 3 more }
union_member_0: object { id, budget, input, 2 more }
id: string
budget: "low" or "standard" or "high" or "unlimited"
"low"
"standard"
"high"
"unlimited"
input: string
nextRunAt: string
type: "scheduled"
"scheduled"
union_member_1: object { id, budget, delayInSeconds, 3 more }
id: string
budget: "low" or "standard" or "high" or "unlimited"
"low"
"standard"
"high"
"unlimited"
delayInSeconds: number
input: string
nextRunAt: string
type: "delayed"
"delayed"
union_member_2: object { id, budget, cron, 3 more }
id: string
budget: "low" or "standard" or "high" or "unlimited"
"low"
"standard"
"high"
"unlimited"
cron: string
input: string
nextRunAt: string
type: "cron"
"cron"
union_member_3: object { id, budget, input, 3 more }
id: string
budget: "low" or "standard" or "high" or "unlimited"
"low"
"standard"
"high"
"unlimited"
input: string
intervalSeconds: number
nextRunAt: string
type: "interval"
"interval"

Create a worker schedule

handinger workers:schedules create \
  --api-key 'My API Key' \
  --worker-id t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM \
  --input x \
  --when "{date: '2019-12-27T18:11:19.117Z', type: scheduled}"
{
  "id": "id",
  "budget": "low",
  "input": "input",
  "nextRunAt": "2019-12-27T18:11:19.117Z",
  "type": "scheduled"
}
Returns Examples
{
  "id": "id",
  "budget": "low",
  "input": "input",
  "nextRunAt": "2019-12-27T18:11:19.117Z",
  "type": "scheduled"
}