Skip to content

CalendarEvents

Model & Relations

Namespace

App\CalendarEvents

Relations

RelationKeyTypeRelation Field(s)
UseruserBelongs touser_id
CalendardepartmentsBelongs to manyIntermediate table
DepartmentsdepartmentsBelongs to manyIntermediate table

Computed Properties

  • hash - The hash representation of the CalendarEvent

Traits

  • TriggersNotifications

WARNING

All kinds of Query Manipulation are disabled for this module.

List

Get a list of all CalendarEvents the current authenticated User is allowed to view.

Definition

GET /api/calendar-events

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/calendar-events', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response Body

json
[
  {
    "id": 1,
    "user_id": 8,
    "calendar_id": 1,
    "title": "CalendarEvent-1",
    "all_day": 1,
    "start": "2020-03-17 00:00:00",
    "end": "2020-03-23 00:00:00",
    "interval": {
      "type": "weekly",
      "each_weeks": 1,
      "days_in_week": [3]
    },
    "interval_end": null,
    "location": null,
    "description": null,
    "created_at": "2020-03-05 09:54:26",
    "updated_at": "2020-03-05 09:54:26",
    "repeat_date": false,
    "hash": "0gzevr2xpolgmwlm4nyd86wj",
    "color": "#009688",
    "user": {
      "id": 8,
      "role_id": 3,
      "username": "jeremy.doe",
      "first_name": "Jeremy",
      "last_name": "Doe",
      "active": 1,
      "group_account": 0,
      "deleted_at": null,
      "blacked_out_at": null,
      "full_name": "Jeremy Doe",
      "online": 0,
      "role": {
        "id": 3,
        "department_id": 3,
        "name": "Usergroup-2",
        "department": {
          "id": 3,
          "name": "Usergroup-2"
        }
      }
    },
    "calendar": {
      "id": 1,
      "name": "Calendar-1",
      "color": "#009688"
    },
    "departments": [
      {
        "id": 2,
        "name": "Usergroup-1"
      },
      {
        "id": 3,
        "name": "User-Group-2"
      },
      {
        "id": 4,
        "name": "User-Group-3"
      }
    ]
  },
  {
    "id": 2,
    "user_id": 8,
    "calendar_id": 2,
    "title": "CalendarEvent-2",
    "all_day": 1,
    "start": "2020-03-03 00:00:00",
    "end": "2020-03-09 00:00:00",
    "interval": null,
    "interval_end": null,
    "location": null,
    "description": null,
    "created_at": "2020-03-05 09:53:38",
    "updated_at": "2020-03-05 09:53:38",
    "repeat_date": false,
    "hash": "0p8mweyzxnlzevlrd5vgk47j",
    "color": "#CDDC39",
    "user": {
      "id": 8,
      "role_id": 3,
      "username": "jeremy.doe",
      "first_name": "Jeremy",
      "last_name": "Schmidt",
      "active": 1,
      "group_account": 0,
      "deleted_at": null,
      "blacked_out_at": null,
      "full_name": "Jeremy Doe",
      "online": 0,
      "role": {
        "id": 3,
        "department_id": 3,
        "name": "UserGroup-2",
        "department": {
          "id": 3,
          "name": "UserGroup-2"
        }
      }
    },
    "calendar": {
      "id": 2,
      "name": "Calendar-2",
      "color": "#CDDC39"
    },
    "departments": [
      {
        "id": 2,
        "name": "Usergroup-1"
      },
      {
        "id": 3,
        "name": "Usergroup-2"
      }
    ]
  }
]

Get

Get a single CalendarEvent by id.

Definition

GET /api/calendar-events/{id}

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/calendar-events/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

json
{
  "id": 1,
  "user_id": 8,
  "calendar_id": 1,
  "title": "CalendarEvent-1",
  "all_day": 1,
  "start": "2020-03-17 00:00:00",
  "end": "2020-03-23 00:00:00",
  "interval": {
    "type": "weekly",
    "each_weeks": 1,
    "days_in_week": [3]
  },
  "interval_end": null,
  "location": null,
  "description": null,
  "created_at": "2020-03-05 09:54:26",
  "updated_at": "2020-03-05 09:54:26",
  "repeat_date": false,
  "hash": "0gzevr2xpolgmwlm4nyd86wj",
  "color": "#009688",
  "user": {
    "id": 8,
    "role_id": 3,
    "username": "jeremy.doe",
    "first_name": "Jeremy",
    "last_name": "Doe",
    "active": 1,
    "group_account": 0,
    "deleted_at": null,
    "blacked_out_at": null,
    "full_name": "Jeremy Doe",
    "online": 0,
    "role": {
      "id": 3,
      "department_id": 3,
      "name": "Usergroup-2",
      "department": {
        "id": 3,
        "name": "Usergroup-2"
      }
    }
  },
  "calendar": {
    "id": 1,
    "name": "Calendar-1",
    "color": "#009688"
  },
  "departments": [
    {
      "id": 2,
      "name": "Usergroup-1"
    },
    {
      "id": 3,
      "name": "User-Group-2"
    },
    {
      "id": 4,
      "name": "User-Group-3"
    }
  ]
}

Create

Create a new CalendarEvent.

Definition

POST /api/calendar-events

Request Keys

KeyTypeDefaultDescription
user_id*integer-The related User
calendar_id*integer-The related Calendar
department_ids*string-The Departments that are allowed to see the CalendarEvent (seperated by comma)
title*string-The title of the CalendarEvent
all_day*boolean-Whether the CalendarEvent is a full day appointment
start*date_time-When the CalendarEvent starts
end*date_time-When the CalendarEvent ends
intervalstring-When to repeat the CalendarEvent.
interval_endstring-When to end the repeating
locationstring-Location of the CalendarEvent
descriptionstring-Description of the CalendarEvent

Keys with * are required.

Advanced Key-Specifications

  • interval - The syntax for intervals can be found here
  • interval_end - The syntax for intervals can be found here

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/calendar-events', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'user_id' => 3,
        'calendar_id' => 1,
        'department_ids' => '2,3',
        'title' => 'CalendarEvent-1',
        'all_day' => true,
        'start' => '2020-01-06 00:00:00',
        'end' => '2020-02-06 00:00:00',
        'interval' => 'w:::1',
        'interval_end' => 'r:::10',
        'location' => '',
        'description' => ''
    ]
]);

Example Response Body

json
{
  "status": "success",
  "data": {
    "user_id": "8",
    "calendar_id": "1",
    "title": "CalendarEvent-1",
    "all_day": "1",
    "start": "2020-01-06 00:00:00",
    "end": "2020-02-06 00:00:00",
    "interval": {
      "type": "weekly",
      "each_weeks": 1
    },
    "interval_end": {
      "type": "repeats",
      "repeats": 3
    },
    "updated_at": "2020-06-05 17:31:06",
    "created_at": "2020-06-05 17:31:06",
    "id": 1,
    "hash": "6o8m0kz5yw10xx1pr9e4vxj2",
    "color": "#2196F3",
    "departments": [
      {
        "id": 2,
        "name": "UserGroup-1",
        "created_at": "2018-09-11 12:47:02",
        "updated_at": "2018-09-11 12:47:02",
        "deleted_at": null
      },
      {
        "id": 3,
        "name": "UserGroup-2",
        "created_at": "2018-09-11 12:47:08",
        "updated_at": "2018-09-11 12:47:08",
        "deleted_at": null
      }
    ],
    "user": {
      "id": 8,
      "username": "jeremy.doe",
      "first_name": "Jeremy",
      "last_name": "Doe",
      "active": 1,
      "group_account": 1,
      "role_id": 2,
      "profile_picture": "/assets/images/profile-pictures/profile-picture-group-account-default.png",
      "street": null,
      "zipcode": null,
      "city": null,
      "email": null,
      "phone": null,
      "birthdate": null,
      "gender": null,
      "entering_date": null,
      "leaving_date": null,
      "staff_number": null,
      "wants_email_notifications": 0,
      "created_at": "2018-09-11 13:47:07",
      "updated_at": "2019-04-26 16:04:02",
      "password_updated_at": "2019-04-26 16:04:02",
      "deactivated_at": null,
      "deleted_at": null,
      "blacked_out_at": null,
      "default_route": "",
      "full_name": " ",
      "online": 0
    },
    "calendar": {
      "id": 1,
      "name": "Calendar-1",
      "color": "#2196F3",
      "sort_number": 1,
      "created_at": "2018-09-11 00:00:00",
      "updated_at": "2018-09-13 19:15:15"
    }
  }
}

Update

Update an existing CalendarEvent by id.

Definition

PUT /api/calendar-event/{id}

Request Keys

KeyTypeDefaultDescription
user_idinteger-The related User
calendar_idinteger-The related Calendar
department_idsstring-The Departments that are allowed to see the CalendarEvent (seperated by comma)
titlestring-The title of the CalendarEvent
all_dayboolean-Whether the CalendarEvent is a full day appointment
startdate_time-When the CalendarEvent starts
enddate_time-When the CalendarEvent ends
intervalstring-When to repeat the CalendarEvent.
interval_endstring-When to end the repeating
locationstring-Location of the CalendarEvent
descriptionstring-Description of the CalendarEvent

Advanced Key-Specifications

  • interval - The syntax for intervals can be found here
  • interval_end - The syntax for intervals can be found here

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/calendar-events/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
        'interval_end' => 'r:::5'
    ]
]);

Example Response

json
{
  "status": "success",
  "data": {
    "id": 1,
    "user_id": 8,
    "calendar_id": 1,
    "title": "CalendarEvent-1",
    "all_day": 1,
    "start": "2020-01-06 00:00:00",
    "end": "2020-02-06 00:00:00",
    "interval": {
      "type": "weekly",
      "each_weeks": 1
    },
    "interval_end": {
      "type": "repeats",
      "repeats": 5
    },
    "location": null,
    "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit",
    "created_at": "2020-06-05 17:31:06",
    "updated_at": "2020-06-05 17:31:06",
    "hash": "6o8m0kz5yw10xx1pr9e4vxj2",
    "color": "#2196F3",
    "calendar": {
      "id": 1,
      "name": "Calendar-1",
      "color": "#2196F3",
      "sort_number": 1,
      "created_at": "2018-09-11 00:00:00",
      "updated_at": "2018-09-13 19:15:15"
    }
  }
}

Delete

Delete an existing CalendarEvent by id.

Definition

DELETE /api/calendar-events/{id}

Example Request

php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/calendar-events/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

json
{
  "status": "success",
  "data": []
}

Interval Syntax

IntervalSub-TypeSyntaxDescription
dailyd:::1repeats every day
weeklyw:::1repeats every week
with weekdaysw:::1d::1,2,3,4,5repeats on the 1st, 2nd, 3rd, 4th and 5th day each week
monthly
daym:::1d::1repeats on the 1st day each month
weekm:::1w::1d::1repeats on the 1st day each week each month
yearly
dayy:::1d::1repeats on the 1st day each year
weeky:::1w::1d::1repeats on the 1st day each week each month
repetitionr:::1Only usable for interval_end. Ends the repeating after 1 repetition