Creating a Schedule for Group Services
This documentation outlines the process of creating a schedule for group services using the Bookla platform. Group service schedules can be set up as single slots or recurring events using RRULE.
Schedule Object Structure
{
"createdAt": "2021-01-01T12:00:00Z",
"duration": "PT1H",
"id": "53ebf47a-9ddc-4198-8f6d-f9ff6a909158",
"resourceID": "53ebf47a-9ddc-4198-8f6d-f9ff6a909158",
"rrule": "FREQ=WEEKLY;BYDAY=MO,WE,FR",
"serviceID": "53ebf47a-9ddc-4198-8f6d-f9ff6a909158",
"startTime": "2021-01-01T12:00:00Z",
"type": "group",
"updatedAt": "2021-01-01T12:00:00Z"
}
Field Descriptions
createdAt
: ISO 8601 timestamp of when the schedule was created.duration
: ISO 8601 duration format specifying the length of each slot.id
: Unique identifier for the schedule.resourceID
: ID of the associated resource (e.g., room, instructor).rrule
: Recurrence rule for repeating events (optional).serviceID
: ID of the associated group service.startTime
: ISO 8601 timestamp for the start of the first slot.type
: Always "group" for group services.updatedAt
: ISO 8601 timestamp of the last update to the schedule.
Creating a Single Slot
To create a single slot, omit the rrule
field and specify the startTime
and duration
:
{
"duration": "PT1H",
"startTime": "2023-06-15T14:00:00Z"
}
This creates a single 1-hour slot starting at 2:00 PM UTC on June 15, 2023.
Creating Recurring Slots
To create recurring slots, include the rrule
field along with startTime
and duration
:
{
"duration": "PT1H",
"repeat": {
"rrule": "FREQ=WEEKLY;BYDAY=MO,WE,FR",
"until": "2030-02-01T12:00:00Z"
},
"startTime": "2023-06-05T10:00:00Z"
}
This creates 1-hour slots every Monday, Wednesday, and Friday at 10:00 AM UTC, starting from June 5, 2023 and until February 1, 2030.
RRULE Syntax
The rrule
field uses the iCalendar RRULE specification. Common components include:
FREQ
: Frequency (DAILY, WEEKLY, MONTHLY, YEARLY)INTERVAL
: How often the recurrence rule repeatsBYDAY
: Days of the week (MO, TU, WE, TH, FR, SA, SU)
Example: FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,TH
This creates slots every other week on Tuesday and Thursday.
Best Practices
- Always specify a
duration
to define the length of each slot. - Use UTC timestamps for
startTime
to avoid timezone issues. - Test your RRULE patterns to ensure they generate the expected schedule.
API Usage
To create a schedule, send a POST request to the schedule creation endpoint with the JSON payload as described above. Refer to the Schedule API Documentation for detailed API usage instructions.
By following these guidelines, you can effectively create and manage schedules for group services, accommodating both single and recurring events.