Schedule Overview

A schedule is used to coordinate actions related to shifts and is essential for creating, assigning, and publishing a schedule.

Attributes

  • id (int) - a unique identifier of the schedule
  • role_id (int) - maps the schedule to its Role
  • state (sting) - see Schedule State Machine for more info
  • demand (JSON) - an hour by hour representation of forecasted demand
  • start (Iso8601 datetime) - when the schedule starts
  • stop (Iso8601 datetime) - when the schedule stops
  • min_shift_length_hour (int) - the minimum number of hours calculated shifts are allowed to be
  • max_shift_length_hour (int) - the maximum number of hours calculated shifts are allowed to be

Schedule Start and Stop

All schedules start at midnight of their location's local timezone on the organization.day_week_starts property and are exactly 1 week long. So if organization.day_week_starts is "monday" and the location's timezone was "America/Los_Angeles", then all schedules will have a 'schedule.start` that corresponds to midnight on Monday in Pacific Time.

The Demand Object

The demand object has an attribute for each day of the week. Each attribute is an array of exactly 24 cells that represent each hour of the day. For example, 9am on Monday corresponds to the 9th index of the "monday" array. The API accepts demand as a serialized JSON.

demand: {
    "monday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
    "tuesday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
    "friday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
    "wednesday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
    "thursday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
    "sunday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0],
    "saturday": [0,0,0,0,0,0,0,0,0,3,4,5,5,5,4,3,3,2,0,0,0,0,0,0]
}