Booking · Events
Restart event pattern
Restarts a stopped repeat pattern for a course event using the supplied organization, mandate, event, pattern and from date. New dates keep the pattern’s weekdays, time and place, and reach as far ahead as the course already has dates. People who booked the whole course are added to the new dates at no extra charge. The response contains inserted, the IDs of the inserted events.
Permissions
Send an API key of the organization in the path, using the X-API-Key header.
Who may call it
- Organization access is required, with
mandate.readandevent.editpermissions.
Request
Path parameters
-
organizationIdidrequired -
mandateIdidrequired -
eventIdidrequired -
patternIdstringrequiredexactly 10 characters
Body
Content-Type: application/json
-
fromstring · 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/patterns/YOUR_PATTERN_ID/restart' \
--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/patterns/YOUR_PATTERN_ID/restart", {
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/patterns/YOUR_PATTERN_ID/restart', 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
- Attendee records can be copied to new dates or updated when event details change.
- Whole-course booking wallet passes can have their expiry dates updated and wallet updates requested.
- Event records can be changed or deleted as dates are regenerated.
- Resource reservations can be inserted, updated or deleted.
- Waitlist sequence numbers can be reserved when waitlisted attendees are copied.
- Event tag usage can be updated for inserted dates.
- Related todo items can be updated when event details change.
- When events are deleted,
booking.deleteEventDatajobs are queued after the transaction. - When events are updated,
booking.processEventUpdatejobs are queued after the transaction. - When events are deleted, a
misc.deleteTodoItemsjob is queued to remove related todo items. - Related bookings can have their event date or title updated when event details change.
Errors
Other errors
| Status | Error | When |
|---|---|---|
| 400 | The repeat patterns of a canceled or deleted course can no longer be restarted. | If the course is not active, the request fails with HTTP 400 and booking.event.restartEventPattern.courseNotActive. |
| 400 | Only a stopped repeat pattern can be restarted. | If the repeat pattern is not stopped, the request fails with HTTP 400 and booking.event.restartEventPattern.notStopped. |
| 400 | The given period is in the past and can not be used | If there is no next recurring date later than the current time, the request fails with HTTP 400 and booking.event.periodInThePast. |
| 400 | The event can not repeat within the same time it still takes place | If consecutive repeat dates are no farther apart than the event duration, the request fails with HTTP 400 and booking.event.applyEventScheduleMutation.ruleRangeLessThanPeriod. |
| 400 | The dates of a course cannot overlap each other. | If course dates overlap, the request can fail with HTTP 400 and booking.event.applyEventScheduleMutation.overlappingDates. |
| 400 | Invalid iCalendar URL | If an iCalendar blocking calendar contains no valid event, and calendar errors are not ignored, the request fails with HTTP 400 and 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 a future, uncanceled event to be deleted has an uncanceled booking, the request fails with HTTP 400 and booking.event.eventMutation.hasBookings. |
| 404 | The given event was not found | If the event is not found in the permitted organization and mandate, the request fails with HTTP 404 and booking.event.eventNotFound. |
| 404 | The repeat pattern was not found. | If the event does not have the requested pattern, the request fails with HTTP 404 and booking.event.getEventCoursePattern.patternNotFound. |
| 404 | The given site was not found | If a resource’s requested site is not found, the request fails with HTTP 404 and booking.resource.siteNotFound. |
| 404 | Resource was not found | If a resource needed for an inserted or updated event is not found, the request can fail with HTTP 404 and booking.event.applyEventResourceReservationMutation.resourceNotFound. |
| 404 | Event was not found | If an event being updated cannot be found, the request fails with HTTP 404 and booking.event.applyEventResourceReservationMutation.eventNotFound. |
Errors nearly every request can meet are listed under Errors.