Unlike appointments made through a normal service events starts and ends at a specific time. An event is connected to a resource and a service. It could be either a one-off event (e.g. a concert) or something that occurs multiple times (e.g. spinning class). Event bookings have a strong relation to the event. That means that it is not possible to modify details such as {booked_from}, {booked_to}, {resource_id} and {service_id} for the {booking}. To make such changes it must be done to the event. All bookings connected to the event will then automatically be modified.
While events are connected to a resource bookings or capacity of an event are not restricted by the opening hours or availability of a resource.
Attributes
| Name | Type | Description |
|---|---|---|
| id | Integer | Automatically set |
| created_at | Datetime | Automatically set |
| updated_at | Datetime | Automatically set |
| resource_id | Integer | Required |
| service_id | Integer | Required |
| published | Boolean | Default: true |
| capacity | Integer | Required |
| starts_at | Datetime | Required |
| ends_at | Datetime | Required |
| custom_data | Array | Not required |
| title | String | |
| description | Text | |
| first_booking_at | Datetime | Not required. Earliest allowed booking time. |
| last_booking_at | Datetime | Not required. Latest allowed booking time. |
| availability | Integer | Only for output. Current available capacity. |
| nr_of_attendances | Integer | Only for output. Number of current attendees. |
Listing
GET /events will return all events.
Response
[
{
"event": {
"capacity": 10,
"created_at": "2012-09-20T15:34:16+02:00",
"custom_data": null,
"description": null,
"ends_at": "2015-08-10T11:30:00+02:00",
"id": 1,
"resource_id": 1,
"published": true,
"starts_at": "2015-08-10T10:00:00+02:00",
"service_id": 1,
"title": "Super fun event",
"updated_at": "2012-09-20T15:34:16+02:00"
}
}
]
Query Parameters
| Name | Type | Description |
|---|---|---|
| service_id | Integer | |
| resource_id | Integer | |
| start | Datetime | starts_at after param |
| end | Datetime | ends_at before param |
| since | Datetime | updated_at after param |
Get event
GET /events/{event_id} will get an event with id {event_id}.
Add new event
POST /events will create a new event.
Add recurring/multiple events
POST /events/recurring will create multiple events.
The recurrence format follows the iCalendar specification. The attributes for recurrence are: RRULE, RDATE, EXDATE. For an introduction and examples of these parameters see this section from the iCalendar specification.
In the iCalendar specification the recurrence is based on values in DTSTART and DTEND. This is set by starts_at and ends_at from event.
All recurring events will except for starts_at and ends_at have the same attributes based on the specified parameters in event.
All events created by the recurring pattern gets the same UUID in collection_id. As the collection name implies, and as is possible with the iCalendar specification, this is not necessarily only for recurrence (i.e. 9am-10am each Friday until December 1st) but also for multiple specific times (as can be specified with RDATE).
Only the collection_id is returned. No events are created at the time of request as they will be processed by the server in the background due to the volume of events that it is possible to create at one time. A successful response with a collection_id does in no way indicate that any events will be created. The first event as defined in event is however validated. If it is not valid errors details are returned in the same way as creating a single event. In such a case recurring rules are not applied and you must adjust the request until validation is successful.
Parameters for recurrence
The parameters for recurrence are not set in event but in recurrence.
| Name | Type | Description |
|---|---|---|
| rrule | String | Repeating pattern. Example: `FREQ=DAILY;UNTIL=19971224T000000Z`. |
| rdate | String | List of recurring dates. Example: `VALUE=DATE:19970101,19970120,19970217,19970421`. |
| exdate | String | List of dates that should be excluded from the recurring rule. Example: `VALUE=DATE:19970102`. |
You should always specify COUNT or UNTIL with RRULE. The max number of occurrences is 731, regardless if a limit is set or not.
List occurrences
GET /events/recurring/{collection_id} will return all occurrences for a collection.
Update event
PUT /events/{event_id} will update existing event with id {event_id}.
Delete event
DELETE /events/{event_id} will delete existing event with id {event_id}. Deleting an event will set it to active=false and will not be returned in any listings.
List bookings
GET /events/{event_id}/bookings will return all bookings for event with id {event_id}.