POST api/Calendar/CreateCalendar

Creates a new calendar. Use this method to create a new calendar.

Exceptions

ExceptionCondition
UnauthorizedAccessException

May be thrown if you do do not have access to calendar

ArgumentNullHttpResponseException

May be thrown if you do not specify the resource id or any other required properties

ArgumentOutOfRangeHttpResponseException

May be thrown if you for example the resource does not exists or if the resource already have a calendar

Examples

The example below shows how to create a new calendar starting 1st of July 2018 and ending 30th of July 2018 with a standard working day from 0800 to 1600.


{
  "ResourceId": "dolly@subbus.no",
  "From": "2018-07-01",
  "To": "2018-07-30",
  "Start": {
    "Hour": 8,
    "Minute": 0
  },
  "End": {
    "Hour": 16,
    "Minute": 0
  },
  "HolidayCalendar": 0,
  "TicketId": "8d9e7eb3-3e23-443d-bb38-ced65c88e168",
  "Culture": "no"
}
The JSON payload below shows just an excerpt of the the returned JSON payload

{
  "CalendarItems": [
    {
      "AttributeName": "61fc4ac3-ee95-4d82-a02f-b38d3b17d873",
      "AttributeAction": 0,
      "AttributeType": 14,
      "AttributeData": {
        "From": "2018-07-02T08:00:00",
        "To": "2018-07-02T16:00:00",
        "ItemType": 0,
        "Id": "61fc4ac3-ee95-4d82-a02f-b38d3b17d873"
      }
    },
    {
      "AttributeName": "c650757b-af46-4ba9-be46-d0516f730fb2",
      "AttributeAction": 0,
      "AttributeType": 14,
      "AttributeData": {
        "From": "2018-07-03T08:00:00",
        "To": "2018-07-03T16:00:00",
        "ItemType": 0,
        "Id": "c650757b-af46-4ba9-be46-d0516f730fb2"
      }
    },
    ...
],
  "From": "2018-07-01T00:00:00",
  "To": "2018-07-30T00:00:00",
  "CombinedPerformanceId": "sesam10:27310f2c-6a30-43da-8979-9721beae51d8"
}

Request Information

URI Parameters

None.

Body Parameters

Specify the resource, calendar start and end and a standard working day.

CreateCalendarArgumentModel
NameDescriptionTypeAdditional information
ResourceId

Get or sets resource id, this property must be set. You must also have access to this user.

string

None.

From

Get or set calendar start date. Date cannot be earlier than 1st of january current year

date

None.

To

Get or set calendar end date. Date cannot be later than 31st of Decemeber, 5 years in the future.

date

None.

Start

Gets or sets start of working period

TimeModel

None.

End

Gets or sets end of working period

TimeModel

None.

CombinedHolidayCalendarId

string

None.

TicketId

Gets or sets the ticket id

string

None.

Culture

Gets or sets culture, if not specified we will use culture set on user.

string

None.

Request Formats

application/json, text/json

Sample:
{
  "ResourceId": "sample string 1",
  "From": "2026-11-11T20:26:44.4666048+01:00",
  "To": "2026-11-11T20:26:44.4666048+01:00",
  "Start": {
    "Hour": 1,
    "Minute": 2
  },
  "End": {
    "Hour": 1,
    "Minute": 2
  },
  "CombinedHolidayCalendarId": "sample string 4",
  "TicketId": "sample string 5",
  "Culture": "sample string 6"
}

application/xml, text/xml

Sample:
<CreateCalendarArgumentModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Rostov.Models">
  <Culture>sample string 6</Culture>
  <TicketId>sample string 5</TicketId>
  <CombinedHolidayCalendarId>sample string 4</CombinedHolidayCalendarId>
  <End>
    <Hour>1</Hour>
    <Minute>2</Minute>
  </End>
  <From>2026-11-11T20:26:44.4666048+01:00</From>
  <ResourceId>sample string 1</ResourceId>
  <Start>
    <Hour>1</Hour>
    <Minute>2</Minute>
  </Start>
  <To>2026-11-11T20:26:44.4666048+01:00</To>
</CreateCalendarArgumentModel>

application/x-www-form-urlencoded

Sample:

Failed to generate the sample for media type 'application/x-www-form-urlencoded'. Cannot use formatter 'JQueryMvcFormUrlEncodedFormatter' to write type 'CreateCalendarArgumentModel'.

Response Information

Resource Description

The newly created calendar including all periods.

CalendarReturnModel
NameDescriptionTypeAdditional information
From

Get or sets the from day

date

None.

To

Gets or sets the to day

date

None.

CombinedPerformanceId

Gets or sets the performance id. If performance monitoring is not turned on this property will not be present or set to null

string

Json null value handling: Ignore

CalendarItems

Gets or sets the periods

Collection of AttributeUpdateModel

None.

Response Formats

application/json, text/json

Sample:
{
  "CalendarItems": [
    {
      "AttributeName": "sample string 1",
      "AttributeAction": 0,
      "AttributeType": 0,
      "AttributeTransaction": "sample string 2",
      "AttributeData": {}
    },
    {
      "AttributeName": "sample string 1",
      "AttributeAction": 0,
      "AttributeType": 0,
      "AttributeTransaction": "sample string 2",
      "AttributeData": {}
    }
  ],
  "From": "2026-11-11T20:26:44.4727421+01:00",
  "To": "2026-11-11T20:26:44.4727421+01:00",
  "CombinedPerformanceId": "sample string 3"
}

application/xml, text/xml

Sample:
<CalendarReturnModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Rostov.Models">
  <CombinedPerformanceId>sample string 3</CombinedPerformanceId>
  <CalendarItems>
    <AttributeUpdateModel>
      <AttributeAction>Add</AttributeAction>
      <AttributeData />
      <AttributeName>sample string 1</AttributeName>
      <AttributeTransaction>sample string 2</AttributeTransaction>
      <AttributeType>Field</AttributeType>
    </AttributeUpdateModel>
    <AttributeUpdateModel>
      <AttributeAction>Add</AttributeAction>
      <AttributeData />
      <AttributeName>sample string 1</AttributeName>
      <AttributeTransaction>sample string 2</AttributeTransaction>
      <AttributeType>Field</AttributeType>
    </AttributeUpdateModel>
  </CalendarItems>
  <From>2026-11-11T20:26:44.4727421+01:00</From>
  <To>2026-11-11T20:26:44.4727421+01:00</To>
</CalendarReturnModel>