POST api/Admin/Calendars/CreateOrUpdateCalendar

Creates a new Calendar.

Request Information

URI Parameters

None.

Body Parameters

CalendarRequest

CreateOrUpdateCalendarRequest
NameDescriptionTypeAdditional information
CalendarId

Calendar Id.

integer

None.

Name

Calendar name.

string

Required

Max length: 255

TimeZone

A valid .NET time zone.

string

Required

Max length: 255

Owner

Specifies the owner of the calendar.

string

Required

Max length: 255

BranchId

Branch Id

integer

None.

CompanyNumber

Company number

string

None.

OrganizationId

Unique id for an company

globally unique identifier

Required

CreateUpdateUser

The user that creates or updates an entity

string

Max length: 255

CalendarProperties

List of calendar properties

Collection of DTOCalendarProperty

None.

Schedules

List of schedules

Collection of Schedule

None.

ScheduledEvents

List of scheduled events

Collection of ScheduledEvent

None.

DeletedCalendarProperties

List of Calendar properties to delete

Collection of integer

None.

DeletedScheduledEvents

List of Scheduled events to delete

Collection of integer

None.

DeletedDaySchedules

List of Day schedules to delete

Collection of integer

None.

DeletedSchedules

List of Schedules to delete

Collection of integer

None.

DeletedDayscheduleDefaultProperties

List of Day schedule default properties to delete

Collection of integer

None.

DeletedScheduledEventDefaultProperties

List of Scheduled event default properties to delete

Collection of integer

None.

Remarks

None.

Example

Creates/updates calendar and it's child entities.
POST: http://localhost/api/calendars

Request Formats

application/json, text/json

Sample:
{
  "CalendarId": 1,
  "Name": "sample string 2",
  "TimeZone": "sample string 3",
  "Owner": "sample string 4",
  "BranchId": 5,
  "CompanyNumber": "sample string 6",
  "OrganizationId": "1989d836-6714-4cb9-aab6-ec9423dfe54b",
  "CreateUpdateUser": "sample string 8",
  "CalendarProperties": [
    {
      "Id": 1,
      "Key": "sample string 2",
      "Value": "sample string 3"
    },
    {
      "Id": 1,
      "Key": "sample string 2",
      "Value": "sample string 3"
    }
  ],
  "Schedules": [
    {
      "ScheduleBase": {
        "Id": 1,
        "Name": "sample string 2",
        "StartDate": "2025-12-20",
        "EndDate": "2025-12-20",
        "ExternalOccupancyRateFactor": 1.0
      },
      "DaySchedules": [
        {
          "DayScheduleBase": {
            "Id": 1,
            "DayOfWeek": "sample string 2",
            "StartTime": "00:00",
            "EndTime": "00:00"
          },
          "DayScheduleDefaultProperties": [
            {
              "Id": 1,
              "Key": "sample string 2",
              "Value": "sample string 3"
            },
            {
              "Id": 1,
              "Key": "sample string 2",
              "Value": "sample string 3"
            }
          ]
        },
        {
          "DayScheduleBase": {
            "Id": 1,
            "DayOfWeek": "sample string 2",
            "StartTime": "00:00",
            "EndTime": "00:00"
          },
          "DayScheduleDefaultProperties": [
            {
              "Id": 1,
              "Key": "sample string 2",
              "Value": "sample string 3"
            },
            {
              "Id": 1,
              "Key": "sample string 2",
              "Value": "sample string 3"
            }
          ]
        }
      ]
    },
    {
      "ScheduleBase": {
        "Id": 1,
        "Name": "sample string 2",
        "StartDate": "2025-12-20",
        "EndDate": "2025-12-20",
        "ExternalOccupancyRateFactor": 1.0
      },
      "DaySchedules": [
        {
          "DayScheduleBase": {
            "Id": 1,
            "DayOfWeek": "sample string 2",
            "StartTime": "00:00",
            "EndTime": "00:00"
          },
          "DayScheduleDefaultProperties": [
            {
              "Id": 1,
              "Key": "sample string 2",
              "Value": "sample string 3"
            },
            {
              "Id": 1,
              "Key": "sample string 2",
              "Value": "sample string 3"
            }
          ]
        },
        {
          "DayScheduleBase": {
            "Id": 1,
            "DayOfWeek": "sample string 2",
            "StartTime": "00:00",
            "EndTime": "00:00"
          },
          "DayScheduleDefaultProperties": [
            {
              "Id": 1,
              "Key": "sample string 2",
              "Value": "sample string 3"
            },
            {
              "Id": 1,
              "Key": "sample string 2",
              "Value": "sample string 3"
            }
          ]
        }
      ]
    }
  ],
  "ScheduledEvents": [
    {
      "ScheduledEventBase": {
        "Id": 1,
        "StartDate": "2025-12-20",
        "EndDate": "2025-12-20",
        "StartTime": "00:00",
        "EndTime": "00:00",
        "Monday": true,
        "Tuesday": true,
        "Wednesday": true,
        "Thursday": true,
        "Friday": true,
        "Saturday": true,
        "Sunday": true,
        "RecurringEventType": "sample string 6",
        "Note": "sample string 7",
        "Active": true,
        "Closed": true
      },
      "ScheduledEventDefaultProperties": [
        {
          "Id": 1,
          "Key": "sample string 2",
          "Value": "sample string 3"
        },
        {
          "Id": 1,
          "Key": "sample string 2",
          "Value": "sample string 3"
        }
      ]
    },
    {
      "ScheduledEventBase": {
        "Id": 1,
        "StartDate": "2025-12-20",
        "EndDate": "2025-12-20",
        "StartTime": "00:00",
        "EndTime": "00:00",
        "Monday": true,
        "Tuesday": true,
        "Wednesday": true,
        "Thursday": true,
        "Friday": true,
        "Saturday": true,
        "Sunday": true,
        "RecurringEventType": "sample string 6",
        "Note": "sample string 7",
        "Active": true,
        "Closed": true
      },
      "ScheduledEventDefaultProperties": [
        {
          "Id": 1,
          "Key": "sample string 2",
          "Value": "sample string 3"
        },
        {
          "Id": 1,
          "Key": "sample string 2",
          "Value": "sample string 3"
        }
      ]
    }
  ],
  "DeletedCalendarProperties": [
    1,
    2
  ],
  "DeletedScheduledEvents": [
    1,
    2
  ],
  "DeletedDaySchedules": [
    1,
    2
  ],
  "DeletedSchedules": [
    1,
    2
  ],
  "DeletedDayscheduleDefaultProperties": [
    1,
    2
  ],
  "DeletedScheduledEventDefaultProperties": [
    1,
    2
  ]
}

application/xml, text/xml

Sample:
<CreateOrUpdateCalendarRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Compilator.Calendar.Service.DTO">
  <Name i:nil="true" />
  <Owner i:nil="true" />
  <TimeZone i:nil="true" />
  <BranchId>5</BranchId>
  <CalendarId>1</CalendarId>
  <CalendarProperties>
    <DTOCalendarProperty>
      <Id>1</Id>
      <Key>sample string 2</Key>
      <Value>sample string 3</Value>
    </DTOCalendarProperty>
    <DTOCalendarProperty>
      <Id>1</Id>
      <Key>sample string 2</Key>
      <Value>sample string 3</Value>
    </DTOCalendarProperty>
  </CalendarProperties>
  <CompanyNumber>sample string 6</CompanyNumber>
  <CreateUpdateUser>sample string 8</CreateUpdateUser>
  <DeletedCalendarProperties xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>1</d2p1:int>
    <d2p1:int>2</d2p1:int>
  </DeletedCalendarProperties>
  <DeletedDaySchedules xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>1</d2p1:int>
    <d2p1:int>2</d2p1:int>
  </DeletedDaySchedules>
  <DeletedDayscheduleDefaultProperties xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:long>1</d2p1:long>
    <d2p1:long>2</d2p1:long>
  </DeletedDayscheduleDefaultProperties>
  <DeletedScheduledEventDefaultProperties xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:long>1</d2p1:long>
    <d2p1:long>2</d2p1:long>
  </DeletedScheduledEventDefaultProperties>
  <DeletedScheduledEvents xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>1</d2p1:int>
    <d2p1:int>2</d2p1:int>
  </DeletedScheduledEvents>
  <DeletedSchedules xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>1</d2p1:int>
    <d2p1:int>2</d2p1:int>
  </DeletedSchedules>
  <Name>sample string 2</Name>
  <OrganizationId>1989d836-6714-4cb9-aab6-ec9423dfe54b</OrganizationId>
  <Owner>sample string 4</Owner>
  <ScheduledEvents>
    <ScheduledEvent>
      <ScheduledEventBase>
        <Active>true</Active>
        <Closed>true</Closed>
        <EndDate>2025-12-20T22:05:04.8291575+00:00</EndDate>
        <EndTime>PT0.1234567S</EndTime>
        <Friday>true</Friday>
        <Id>1</Id>
        <Monday>true</Monday>
        <Note>sample string 7</Note>
        <RecurringEventType>sample string 6</RecurringEventType>
        <Saturday>true</Saturday>
        <StartDate>2025-12-20T22:05:04.8291575+00:00</StartDate>
        <StartTime>PT0.1234567S</StartTime>
        <Sunday>true</Sunday>
        <Thursday>true</Thursday>
        <Tuesday>true</Tuesday>
        <Wednesday>true</Wednesday>
      </ScheduledEventBase>
      <ScheduledEventDefaultProperties>
        <DTOScheduledEventDefaultPropertyBase>
          <Id>1</Id>
          <Key>sample string 2</Key>
          <Value>sample string 3</Value>
        </DTOScheduledEventDefaultPropertyBase>
        <DTOScheduledEventDefaultPropertyBase>
          <Id>1</Id>
          <Key>sample string 2</Key>
          <Value>sample string 3</Value>
        </DTOScheduledEventDefaultPropertyBase>
      </ScheduledEventDefaultProperties>
    </ScheduledEvent>
    <ScheduledEvent>
      <ScheduledEventBase>
        <Active>true</Active>
        <Closed>true</Closed>
        <EndDate>2025-12-20T22:05:04.8291575+00:00</EndDate>
        <EndTime>PT0.1234567S</EndTime>
        <Friday>true</Friday>
        <Id>1</Id>
        <Monday>true</Monday>
        <Note>sample string 7</Note>
        <RecurringEventType>sample string 6</RecurringEventType>
        <Saturday>true</Saturday>
        <StartDate>2025-12-20T22:05:04.8291575+00:00</StartDate>
        <StartTime>PT0.1234567S</StartTime>
        <Sunday>true</Sunday>
        <Thursday>true</Thursday>
        <Tuesday>true</Tuesday>
        <Wednesday>true</Wednesday>
      </ScheduledEventBase>
      <ScheduledEventDefaultProperties>
        <DTOScheduledEventDefaultPropertyBase>
          <Id>1</Id>
          <Key>sample string 2</Key>
          <Value>sample string 3</Value>
        </DTOScheduledEventDefaultPropertyBase>
        <DTOScheduledEventDefaultPropertyBase>
          <Id>1</Id>
          <Key>sample string 2</Key>
          <Value>sample string 3</Value>
        </DTOScheduledEventDefaultPropertyBase>
      </ScheduledEventDefaultProperties>
    </ScheduledEvent>
  </ScheduledEvents>
  <Schedules>
    <Schedule>
      <DaySchedules>
        <DaySchedule>
          <DayScheduleBase>
            <DayOfWeek>sample string 2</DayOfWeek>
            <EndTime>PT0.1234567S</EndTime>
            <Id>1</Id>
            <StartTime>PT0.1234567S</StartTime>
          </DayScheduleBase>
          <DayScheduleDefaultProperties>
            <DTODayScheduleDefaultPropertyBase>
              <Id>1</Id>
              <Key>sample string 2</Key>
              <Value>sample string 3</Value>
            </DTODayScheduleDefaultPropertyBase>
            <DTODayScheduleDefaultPropertyBase>
              <Id>1</Id>
              <Key>sample string 2</Key>
              <Value>sample string 3</Value>
            </DTODayScheduleDefaultPropertyBase>
          </DayScheduleDefaultProperties>
        </DaySchedule>
        <DaySchedule>
          <DayScheduleBase>
            <DayOfWeek>sample string 2</DayOfWeek>
            <EndTime>PT0.1234567S</EndTime>
            <Id>1</Id>
            <StartTime>PT0.1234567S</StartTime>
          </DayScheduleBase>
          <DayScheduleDefaultProperties>
            <DTODayScheduleDefaultPropertyBase>
              <Id>1</Id>
              <Key>sample string 2</Key>
              <Value>sample string 3</Value>
            </DTODayScheduleDefaultPropertyBase>
            <DTODayScheduleDefaultPropertyBase>
              <Id>1</Id>
              <Key>sample string 2</Key>
              <Value>sample string 3</Value>
            </DTODayScheduleDefaultPropertyBase>
          </DayScheduleDefaultProperties>
        </DaySchedule>
      </DaySchedules>
      <ScheduleBase>
        <EndDate>2025-12-20T22:05:04.8291575+00:00</EndDate>
        <ExternalOccupancyRateFactor>1</ExternalOccupancyRateFactor>
        <Id>1</Id>
        <Name>sample string 2</Name>
        <StartDate>2025-12-20T22:05:04.8291575+00:00</StartDate>
      </ScheduleBase>
    </Schedule>
    <Schedule>
      <DaySchedules>
        <DaySchedule>
          <DayScheduleBase>
            <DayOfWeek>sample string 2</DayOfWeek>
            <EndTime>PT0.1234567S</EndTime>
            <Id>1</Id>
            <StartTime>PT0.1234567S</StartTime>
          </DayScheduleBase>
          <DayScheduleDefaultProperties>
            <DTODayScheduleDefaultPropertyBase>
              <Id>1</Id>
              <Key>sample string 2</Key>
              <Value>sample string 3</Value>
            </DTODayScheduleDefaultPropertyBase>
            <DTODayScheduleDefaultPropertyBase>
              <Id>1</Id>
              <Key>sample string 2</Key>
              <Value>sample string 3</Value>
            </DTODayScheduleDefaultPropertyBase>
          </DayScheduleDefaultProperties>
        </DaySchedule>
        <DaySchedule>
          <DayScheduleBase>
            <DayOfWeek>sample string 2</DayOfWeek>
            <EndTime>PT0.1234567S</EndTime>
            <Id>1</Id>
            <StartTime>PT0.1234567S</StartTime>
          </DayScheduleBase>
          <DayScheduleDefaultProperties>
            <DTODayScheduleDefaultPropertyBase>
              <Id>1</Id>
              <Key>sample string 2</Key>
              <Value>sample string 3</Value>
            </DTODayScheduleDefaultPropertyBase>
            <DTODayScheduleDefaultPropertyBase>
              <Id>1</Id>
              <Key>sample string 2</Key>
              <Value>sample string 3</Value>
            </DTODayScheduleDefaultPropertyBase>
          </DayScheduleDefaultProperties>
        </DaySchedule>
      </DaySchedules>
      <ScheduleBase>
        <EndDate>2025-12-20T22:05:04.8291575+00:00</EndDate>
        <ExternalOccupancyRateFactor>1</ExternalOccupancyRateFactor>
        <Id>1</Id>
        <Name>sample string 2</Name>
        <StartDate>2025-12-20T22:05:04.8291575+00:00</StartDate>
      </ScheduleBase>
    </Schedule>
  </Schedules>
  <TimeZone>sample string 3</TimeZone>
</CreateOrUpdateCalendarRequest>

application/x-www-form-urlencoded

Sample:

Sample not available.

Response Information

Resource Description

Returns calendar api key and id of the created calendar.

CreateOrUpdateCalendarResponse
NameDescriptionTypeAdditional information
CalendarId

Id for the calendar that was created.

integer

None.

MasterKey

Key for the calendar. The key must be used when performing operations on the calendar.

string

None.

Response Formats

application/json, text/json

Sample:
{
  "CalendarId": 1,
  "MasterKey": "sample string 2"
}

application/xml, text/xml

Sample:
<CreateOrUpdateCalendarResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Compilator.Calendar.Service.DTO">
  <CalendarId>1</CalendarId>
  <MasterKey>sample string 2</MasterKey>
</CreateOrUpdateCalendarResponse>