Booking ยท Events
Archive event
Archives or restores all dates in an event series, using the organization, mandate and event IDs and an archived boolean. A series can be archived only if it has no upcoming active dates. Archived events are hidden from event lists, public pages and the Connect app. The endpoint returns no body.
Permissions
Send an API key of the organization in the path, using the X-API-Key header.
Who may call it
- The caller must have organization access.
- The caller needs the
mandate.readpermission. - The caller needs the
event.editpermission.
Request
Path parameters
-
organizationIdidrequired -
mandateIdidrequired -
eventIdidrequired
Body
Content-Type: application/json
-
archivedbooleanrequired
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/archive' \
--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/archive", {
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/archive', 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
No response body is specified.
What else happens
- On success, the endpoint updates
archivedAton all events in the series, setting it to the current time when archiving or null when restoring.
Errors
Other errors
| Status | Error | When |
|---|---|---|
| 400 | Only events whose dates are all over or cancelled can be archived. | If archiving is requested and the series has upcoming active dates, the endpoint returns HTTP 400 with key routes.booking.events.archiveEvent.hasUpcomingDates. |
| 404 | The given event was not found | If the event is not found, the endpoint returns HTTP 404 with key booking.event.eventNotFound. |
Errors nearly every request can meet are listed under Errors.