Skip to content
Get started

Create a worker schedule

workers.schedules.create(worker_id, **kwargs) -> WorkerSchedule
POST/api/workers/{workerId}/schedules

Schedule a worker instruction for a future or recurring run.

ParametersExpand Collapse
worker_id: String
input: String
minLength1
when_: Scheduled{ date, type} | Delayed{ delay_in_seconds, type} | Cron{ cron, type} | Interval{ interval_seconds, type}
One of the following:
class Scheduled { date, type }
date: String
minLength1
type: :scheduled
class Delayed { delay_in_seconds, type }
delay_in_seconds: Integer
minimum1
maximum31536000
type: :delayed
class Cron { cron, type }
cron: String
minLength1
type: :cron
class Interval { interval_seconds, type }
interval_seconds: Integer
minimum1
maximum31536000
type: :interval
budget: :low | :standard | :high | :unlimited
One of the following:
:low
:standard
:high
:unlimited
ReturnsExpand Collapse
WorkerSchedule = Scheduled{ id, budget, input, 2 more} | Delayed{ id, budget, delay_in_seconds, 3 more} | Cron{ id, budget, cron, 3 more} | Interval{ id, budget, input, 3 more}
One of the following:
class Scheduled { id, budget, input, 2 more }
id: String
budget: :low | :standard | :high | :unlimited
One of the following:
:low
:standard
:high
:unlimited
input: String
next_run_at: Time
formatdate-time
type: :scheduled
class Delayed { id, budget, delay_in_seconds, 3 more }
id: String
budget: :low | :standard | :high | :unlimited
One of the following:
:low
:standard
:high
:unlimited
delay_in_seconds: Integer
input: String
next_run_at: Time
formatdate-time
type: :delayed
class Cron { id, budget, cron, 3 more }
id: String
budget: :low | :standard | :high | :unlimited
One of the following:
:low
:standard
:high
:unlimited
cron: String
input: String
next_run_at: Time
formatdate-time
type: :cron
class Interval { id, budget, input, 3 more }
id: String
budget: :low | :standard | :high | :unlimited
One of the following:
:low
:standard
:high
:unlimited
input: String
interval_seconds: Integer
next_run_at: Time
formatdate-time
type: :interval

Create a worker schedule

require "handinger"

handinger = Handinger::Client.new(api_key: "My API Key")

worker_schedule = handinger.workers.schedules.create(
  "t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM",
  input: "x",
  when_: {date: "x", type: :scheduled}
)

puts(worker_schedule)
{
  "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"
}