The Slotify Scheduler endpoint supports customizable scheduling constraints using the rules
parameter. This parameter enables you to define availability windows with precise control over allowed or blocked times based on hours, date periods, and specific days of the week.
Constraint Rules
Constraints in Slotify’s Scheduler endpoint fall into three main categories: Hours, Periods, and Daytime. Each rule type can be configured as either allowed or blocked, enabling fine-grained control over scheduling availability.
1. Hours
The hours
rule type defines allowed or blocked hours within each day. This rule is useful for setting daily work hours or blocking certain times consistently across all days.
Key | Value |
---|---|
rule | hours |
type | allowed or blocked |
times | An array of time ranges with start and end (24-hour format) |
Example:
- JSON
{
"rule": "hours",
"type": "allowed",
"times": [
{
"start": "09:00",
"end": "17:00"
}
]
}
This rule allows scheduling only between 09:00 and 17:00 each day.
2. Periods
The periods
rule type allows scheduling within specific date ranges or restricts availability during certain periods. It’s useful for holiday closures, seasonal availabilities, or multi-day events.
Key | Value |
---|---|
rule | periods |
type | allowed or blocked |
periods | An array of date ranges with start and end in ISO 8601 format |
Example:
- JSON
{
"rule": "periods",
"type": "blocked",
"periods": [
{
"start": "2024-11-05T00:00:00.000Z",
"end": "2024-11-06T23:55:00.000Z"
}
]
}
You must supply date in UTC format to avoid wrong date time conversion. This rule blocks scheduling from November 5, 2024, at 00:00 UTC to November 6, 2024, at 23:55 UTC.
3. Daytime
The daytime
rule type sets constraints based on specific days of the week, such as blocking weekends or setting unique hours for weekdays.
Key | Value |
---|---|
rule | daytime |
type | allowed or blocked |
times | An array of time ranges with start and end |
Example:
- JSON
{
"day": "monday",
"rule": "daytime",
"type": "allowed",
"times": [
{
"start": "09:00",
"end": "17:00"
}
]
}
This rule allows scheduling only between 09:00 and 17:00 on Mondays.
Example rules Configuration
Below is an example configuration that combines multiple constraints:
In this example:
- Scheduling is allowed only from 09:00 to 17:00 daily.
- Scheduling is blocked on November 5-6, 2024.
- Scheduling is blocked on Tuesdays from 09:00 to 17:00.
- JSON
{
"rules": [
{
"rule": "hours",
"type": "allowed",
"times": [
{
"start": "09:00",
"end": "17:00"
}
]
},
{
"rule": "periods",
"type": "blocked",
"periods": [
{
"start": "2024-11-05T00:00:00.000Z",
"end": "2024-11-06T23:55:00.000Z"
}
]
},
{
"day": "tuesday",
"rule": "daytime",
"type": "blocked",
"times": [
{
"start": "09:00",
"end": "17:00"
}
]
}
],
}
This rules
system provides flexibility in defining when bookings can occur based on business or service requirements.