periods field. This page explains how to configure this field for different use cases.
Periods schema
List of periods in the schedule. Periods can be defined explicitly or through a recurrent definition (for example, to generate weeks).
Periods created through days
The most basic way to define periods is to refer to specific days in the roster. This is done by using thedays field in the periods object.
Within this object, you can specify specific days using dates (in CALENDAR payloads) or dayIndices (in RECURRING payloads).
Referring to specific days using dates
Days of the week
Alternatively, you can specify the days of the week usingdaysOfWeek. For example, the following periods definition will refer to all Wednesdays and Fridays in the roster.
Referring to specific days using days of week
Start and end times
Finally, you can add astartTime and endTime to the days object to specify a time interval during the day. For example, the following periods definition will refer to all evenings on Wednesdays and Fridays.
This could be useful for instance to specify that an employee is not available for work during these times (though they are still available for work earlier in these days).
Referring to specific days using days of week and time interval
Creating periods through days will always consider each day in the roster as a
separate period. This is relevant for some rules where the targets of the
rule are applied to each period separately.
Periods created through custom definitions
If you need to create periods consisting of multiple days, you can use thecustomDefinitions field in the periods object. These are defined through a start and end day (and optionally a start and end time).
For example, the following periods definition will refer to the period from January 1st to January 5th and the period from February 10th to February 14th.
Referring to a custom period using start and end days
Start and end times
Similarly to thedays field, you can also add a startTime and endTime to the customDefinitions object to specify a time interval during the day.
For example, the following periods definition will refer to the period from 10:00 on January 1st to 18:00 on January 5th.
Referring to a custom period using start and end days and time interval
Applying time to all days
Finally, custom period definitions allow you to choose whether the start and end time should apply to each day individually. For example, the following periods definition will refer to all periods of time between 20:00 and 06:00 on every day between January 1st and January 31st.Referring to a custom period using start and end days and time interval and applying time to all days
applyTimeToAllDays is set to false.
Periods created through recurrent definitions
If you want to create periods that are all the same length, therecurrentDefinition field might suit your needs. For example, if you want to create a rule that applies on a weekly basis, the recurrent definition allows you to
easily specify this without having to define each week by its exact start and end days.
For example, the following recurrent definition will create a non-overlapping set of periods that are each 7 days long, starting from the first day and continuing until the last day of the roster.
Defining weekly periods using a recurrent definition
Restricting the range of periods
If you only need your recurrent definition to create periods for a certain range within your roster, you can also specify thestartDay and endDay properties.
For example, the following recurrent definition will create a non-overlapping set of periods that are each 7 days long, starting from April 1st and continuing until June 30th.
Defining weekly periods for a specific range
Overlapping and non-consecutive periods
By default, periods created through a recurrent definition will be non-overlapping and consecutive. If you want to create a sliding window of periods, you can use thedaysBetweenStarts property. For example, we could use the following periods on a rule to make sure that an employee never works more than 40 hours in any 7-day period.
Defining weekly periods with a sliding window
Start and end times
Recurrent definitions allow for the use of start and end time similarly to custom definitions. This example shows a recurrent definition for weekend periods that start Friday afternoon and last until Sunday night.Defining weekend periods with a start and end time
Period labels
If there are periods that are useful in multiple rules, you can define them inextensions.labeling.periods.
This can greatly reduce the size of your payloads when handled properly, and it can be smart to identify which periods are applicable for this within your integration.
The below example shows how to define labels for weekends and then reuse them on an availability rule to make it undesirable for employees to work on weekends.
Defining labels for commonly reused periods
