Deletes one or more bookings

DELETE /api/bookings

Success: 200 OK

Overview

Cancels a batch of bookings in one call. For each booking, every member booked on to it is removed; a booking that has nobody on it is deleted outright.

This endpoint is deliberately partial. It returns 200 OK with the ids sorted into three lists — deleted, notFound and notDeleted — and it returns 200 even when nothing at all was deleted. Read the body, not the status code, and expect to reconcile: some ids can succeed while others fail in the same request.

One check does apply to the whole batch before anything is touched. If any of the bookings has attendance recorded against it, the call fails with 400 and nothing is deleted, however many of the others were fine. Attendance is therefore the one failure you never see reflected in notDeleted — drop the attended ids and send the rest.

Bookings are cancelled member by member, so a booking with several members on it can be left half cancelled if a later member fails: the earlier deletions stand, and the id is reported in notDeleted. Re-sending the same id is safe — the members already gone are simply not there any more.

To remove a booking that has no members on it, and only that, use Delete a booking completely and utterly. To release a hold that was never confirmed into a booking, use Delete a booking lease instead.

Endpoint

DELETE {base_url}/api/bookings

{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.

Query parameters

NameTypeRequiredDescription
bookingIdsstringYesThe bookings to cancel, as a comma-separated list in a single parameter — ?bookingIds=101,102,103 — not a repeated parameter. Required despite the schema marking it optional: omitting it or sending it empty fails with One or more Booking IDs must be specified. Every entry must parse as an integer of 1 or more, or the whole request fails with The given booking ID of {value} must be an integer greater than zero before anything is deleted. Ids that do not exist are not an error here; they come back in notFound.

Sample request

cURL
curl -X DELETE '{base_url}/api/bookings' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'

Response fields

FieldTypeDescription
deletedarray of integerThe bookings that were fully cancelled — every member removed, or the empty booking deleted. These are done; do not re-send them.
notFoundarray of integerThe bookings that could not be located while being cancelled: no booking with that id, or a member on it that the delete could not resolve. Treat these as already gone rather than retrying — a repeat produces the same result.
notDeletedarray of integerThe bookings that were found but rejected or errored — for example one that can no longer be cancelled, or a server-side failure part-way through. No reason is returned, only the id, so inspect the booking to find out why. A multi-member booking listed here may have had some of its members removed before the failure.

Sample response

200 OK
{
  "deleted": [
    101,
    102
  ],
  "notFound": [
    103
  ],
  "notDeleted": [
    104
  ]
}

Errors

StatusMeaningWhen
400Bad requestbookingIds is missing or empty — One or more Booking IDs must be specified.
400Bad requestAn id in the list is not a positive integer — The given booking ID of {value} must be an integer greater than zero. Nothing is deleted; fix the list and send it again.
400Bad requestAt least one booking in the batch has attendance recorded — At least one of the bookings has attendance recorded against it and cannot be deleted. Nothing in the batch is deleted, including the bookings that would have succeeded.
400Bad requestThe attendance check itself failed — The booking attendances could not be verified: {message}, where {message} is passed through from the bookings service. Nothing is deleted.
404Not foundThe attendance check could not find one of the bookings — The booking attendances could not be verified: {message}. This is the batch-level check, so nothing is deleted; an id that is merely unknown at deletion time is reported in notFound with a 200 instead.
500Internal server errorAny unexpected server-side failure, with an empty body. Failures on an individual booking do not reach here — they are absorbed into notDeleted.

This page as markdown · All pages · llms.txt