Booking · Events
Add event date
Adds a date outside the repeat pattern of the specified event’s course. It takes the organization, mandate, event and new period, and returns inserted. Eligible whole-course attendees are added to the new date at no extra charge.
Permissions
Send an API key of the organization in the path, using the X-API-Key header.
Who may call it
- Organization access requires
mandate.readandevent.edit. - The event lookup applies the mandate filter using the caller’s organization access.
Request
Path parameters
-
organizationIdidrequired -
mandateIdidrequired -
eventIdidrequired
Body
Content-Type: application/json
-
periodobjectrequired2 properties
-
fromstring · date-timerequired -
tostring · date-timerequired
-
Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
--request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/booking/events/YOUR_EVENT_ID/dates' \
--header 'X-API-Key: YOUR_API_KEY'const response = await fetch("https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/booking/events/YOUR_EVENT_ID/dates", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY"
},
redirect: 'error',
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) throw new Error(`campai HTTP ${response.status}`);
const text = await response.text();
const result = text ? JSON.parse(text) : null;
console.log(JSON.stringify(result, null, 2));<?php
$context = stream_context_create(['http' => [
'method' => 'POST',
'header' => [
'X-API-Key: YOUR_API_KEY',
],
'timeout' => 30,
'follow_location' => 0,
'ignore_errors' => true,
]]);
$text = @file_get_contents('https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/booking/events/YOUR_EVENT_ID/dates', false, $context);
preg_match('/^HTTP\/\S+ (\d{3})/', $http_response_header[0] ?? '', $match);
$status = (int) ($match[1] ?? 0);
if ($text === false || $status < 200 || $status >= 300) {
throw new RuntimeException("campai HTTP $status (0 means no response)");
}
$result = $text === '' ? null : json_decode($text, true, 512, JSON_THROW_ON_ERROR);
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR), PHP_EOL;
No request that worked has been recorded yet, so the body is not shown.
Response
200 Successful response
Content-Type: application/json
-
insertedid[]
Response200
{
"inserted": [
"000000000000000000000001"
]
}
What else happens
- Eligible whole-course attendees are added to the new date at no extra charge.
- If the course end changes, course booking wallet passes can have their expiry updated and wallet updates requested.
- Course dates can be renumbered and their shared pattern information updated.
- Resource reservations can be created for inserted events that use a resource.
- When waitlisted attendees are copied, waitlist sequence numbers are reserved for the new event.
- Tag usage is updated for the inserted dates.
- If relevant event details are updated, associated todo items can be updated.
- If events are deleted,
booking.deleteEventDatajobs are queued after the transaction. - If events are updated,
booking.processEventUpdatejobs are queued after the transaction. - If events are deleted, a
misc.deleteTodoItemsjob is queued for their todo items. - When applicable event updates are processed, associated bookings can have their event date or title updated.
Errors
Other errors
| Status | Error | When |
|---|---|---|
| 400 | Dates can only be added to a course that is not canceled or deleted. | If the course is not active, the request returns HTTP 400 with booking.event.addEventDate.courseNotActive. |
| 400 | The event cannot overlap another event in the same series. | If the new period overlaps another event in the series, the request returns HTTP 400 with booking.event.validateNoEventSeriesOverlap.overlappingOccurrenceInSeries. |
| 400 | Invalid iCalendar URL | If a blocking iCalendar contains no valid event and its errors are not ignored, the request returns HTTP 400 with booking.event.invalidIcalendarUrl. |
| 400 | One of the events deleted in the operation cannot be deleted because it has bookings. Please cancel the events first to refund all its bookings. | If an event to be deleted is in the future, is not canceled and has a non-canceled booking, the request returns HTTP 400 with booking.event.eventMutation.hasBookings. |
| 404 | The given event was not found | If the event is not found in the applicable organization and mandate, the request returns HTTP 404 with booking.event.eventNotFound. |
| 404 | The given site was not found | If a resource availability check cannot find the requested site on the resource, the request returns HTTP 404 with booking.resource.siteNotFound. |
| 404 | Resource was not found | If an inserted event refers to a resource that cannot be found, the request returns HTTP 404 with booking.event.applyEventResourceReservationMutation.resourceNotFound. |
| 404 | Resource was not found | The same HTTP 404 error can occur if a resource needed to recheck an updated event cannot be found. |
| 404 | Event was not found | If an event needed for a resource reservation update cannot be found, the request returns HTTP 404 with booking.event.applyEventResourceReservationMutation.eventNotFound. |
Errors nearly every request can meet are listed under Errors.