Create Calendar
Overview
POST /rest/calendar
This endpoint is used to create a calendar.
See https://www.joda.org/joda-time/timezones.html for accepted time zone names.
Required Permissions
Admin can create a calendar.
Request
This endpoint is admin only and requires authentication.
POST <service_url>/rest/calendar
Request Body
The request body must be a JSON object with the following structure:
{
"name": String, // The name of the calendar
"timeZone": String, // The time zone of the calendar, serialized using DateTimeZoneSerializer
"holidays": [
{
"name": String, // The name of the holiday
"date": String, // The date of the holiday
"recurring": Boolean // Indicates if the holiday is recurring
}
],
"workingTimes": [
{
"weekday": String, // The day of the week
"start": Long, // The start time in milliseconds
"end": Long // The end time in milliseconds
}
]
}
Example Request Body
{
"name": "Calendar 2",
"timeZone": "Europe/Istanbul",
"workingTimes": [
{
"weekday": "MONDAY",
"start": 28800000,
"end": 61200000
},
{
"weekday": "MONDAY",
"start": 75600000,
"end": 82800000
}
],
"holidays": [
{
"name": "Holiday 1",
"date": "2025-04-28",
"recurring": true
}
]
}
Example Requests
POST https://tis.obss.io/rest/calendar
Response
Response Structure
{
"id": Integer, // The unique identifier of the calendar
"name": String, // The name of the calendar
"clientKey": String, // The client key associated with the calendar
"isDefault": Boolean, // Indicates if this is the default calendar
"is7x24Calendar": Boolean, // Indicates if the calendar operates 24/7
"allWorkingDaysHaveEqualLengths": Boolean, // Indicates if all working days have equal lengths
"calendarSuccessfullyLoaded": Boolean, // Indicates if the calendar was successfully loaded
"dailyWorkingHours": Double, // The number of working hours per day
"timeZone": String, // The time zone of the calendar
"workingTimes": [
{
"weekday": String, // The day of the week
"start": Long, // The start time in milliseconds
"end": Long // The end time in milliseconds
}
],
"holidays": [
{
"name": String, // The name of the holiday
"date": String, // The date of the holiday
"recurring": Boolean // Indicates if the holiday is recurring
}
]
}
Example Response Body
{
"clientKey": "ffa2107c-c816-3aa3-985a-0163faa27103",
"id": 3,
"isDefault": false,
"name": "Calendar 2",
"timeZone": "Europe/Istanbul",
"workingTimes": [
{
"weekday": "MONDAY",
"start": 28800000,
"end": 61200000
},
{
"weekday": "MONDAY",
"start": 75600000,
"end": 82800000
}
],
"holidays": [
{
"name": "Holiday 1",
"date": "2025-04-28",
"recurring": true
}
],
"is7x24Calendar": false,
"allWorkingDaysHaveEqualLengths": true,
"calendarSuccessfullyLoaded": true,
"dailyWorkingHours": 11.0
}
Response Codes
200 OK: Returns the created calendar object.
400 Bad Request: If the request body is invalid.