Sign in to see your venue's slug and publishable key in every sample.
Your account has no venue yet, so the samples keep their placeholders. Sign out
Signed in as · . Create a publishable key in the console and reload to see it here. Sign out
Signed in as · . The samples show your venue's publishable key. Sign out
Developer docs
Swapping two bookings
Swap the resources of two bookings of the same day in one atomic step from the operator API, safe to retry, with every refusal named.
Staff often have to swap two bookings: the party of six sits at the four-seat table and the couple at the six-seat table, or two billiard groups want each other's tables. Two ordinary moves would each collide with the other booking, so the operator API swaps the two resources in one transaction. Only the resource changes; times, party, contact, status, deposit and a running play clock stay with each booking. This route is an operator route: it takes the signed-in operator's token, never an API key, acts on the venue the token (and an optional X-BookDinePlay-Venue header) selects, and is open to every team role from Staff up.
Endpoint
POST /api/operator/venue/reservations/swap
| Field | Required | Meaning |
|---|---|---|
firstReference |
yes | The first booking's reference. |
firstExpectedResourceId |
yes | The resource id you saw the first booking on (resourceId on the operator summary). |
secondReference |
yes | The second booking's reference. |
secondExpectedResourceId |
yes | The resource id you saw the second booking on. |
The expected resources make the call safe to retry without an Idempotency-Key. If the two are on the expected resources, they are swapped. If they are already the other way round (a retry of a swap that went through), the answer is 200 with "alreadySwapped": true and nothing is written. Anything else is refused with swap-stale: someone changed them meanwhile, so reload the day. An undo is the same call with the two expected resources exchanged.
curl
curl -X POST "https://api.bookdineplay.com/api/operator/venue/reservations/swap" \
-H "Authorization: Bearer $OPERATOR_TOKEN" \
-H "X-BookDinePlay-Venue: your-venue" \
-H "Content-Type: application/json" \
-d '{ "firstReference": "BDP-7Q2M3K", "firstExpectedResourceId": "table-4", "secondReference": "BDP-K9X4WD", "secondExpectedResourceId": "table-6" }'JavaScript
// Server-side or in your own console: the bearer token is the signed-in operator's, never a venue key.
const response = await fetch('https://api.bookdineplay.com/api/operator/venue/reservations/swap', {
method: 'POST',
headers: {
Authorization: `Bearer ${operatorToken}`,
'X-BookDinePlay-Venue': 'your-venue',
'Content-Type': 'application/json'
},
body: JSON.stringify({
firstReference: 'BDP-7Q2M3K', firstExpectedResourceId: 'table-4',
secondReference: 'BDP-K9X4WD', secondExpectedResourceId: 'table-6'
})
});
const swap = await response.json();
console.log(swap.first.resourceName, swap.second.resourceName, swap.warnings);C#
// `http` is an HttpClient with the operator's bearer token and the API base address.
var response = await http.PostAsJsonAsync(
"api/operator/venue/reservations/swap",
new SwapReservationResourcesRequest("BDP-7Q2M3K", "table-4", "BDP-K9X4WD", "table-6"), cancellationToken);
var swap = await response.Content.ReadFromJsonAsync<SwapReservationResourcesResponse>(cancellationToken);
Console.WriteLine($"{swap!.First.ResourceName} / {swap.Second.ResourceName}");PHP
<?php
$response = wp_remote_post( 'https://api.bookdineplay.com/api/operator/venue/reservations/swap', [
'headers' => [
'Authorization' => 'Bearer ' . $operator_token,
'X-BookDinePlay-Venue' => 'your-venue',
'Content-Type' => 'application/json',
],
'body' => wp_json_encode( [
'firstReference' => 'BDP-7Q2M3K',
'firstExpectedResourceId' => 'table-4',
'secondReference' => 'BDP-K9X4WD',
'secondExpectedResourceId' => 'table-6',
] ),
] );
$swap = json_decode( wp_remote_retrieve_body( $response ), true );
echo "{$swap['first']['resourceName']} / {$swap['second']['resourceName']}
";The answer
200 with first and second, both operator summaries in the order of the request (the same shape GET /api/operator/venue/reservations/{reference} returns, play clock included), alreadySwapped on a retry, and warnings when the console went past a guest rule at a new resource: blocked-online (the resource is blocked for online booking then) or inside-buffer (it lies in the buffer after a neighbouring booking). Both are warnings, not refusals, exactly as for any other console edit.
{
"first": { "reference": "BDP-7Q2M3K", "resourceId": "table-6", "resourceName": "Table 6", "start": "19:00", "end": "21:00", "partySize": 6 },
"second": { "reference": "BDP-K9X4WD", "resourceId": "table-4", "resourceName": "Table 4", "start": "19:00", "end": "21:00", "partySize": 2 },
"warnings": ["inside-buffer"]
}What a swap never does
- No money moves. No deposit, estimate or minimum spend is recomputed, even when the new resource is priced differently; nothing is charged, refunded or held on a voucher.
- Nobody is notified. The guests get no e-mail, push or SMS, and staff get no push: nothing about the booking changes for the guest, and the swap is staff's own action.
- A running play clock carries on at the new resource with the hourly price captured at its start, which is why two resources with different hourly prices are refused while a clock runs.
Each swap writes one reservation.swapped entry per booking to the audit log, with both placements. A retry or a refusal writes none.
Refusals
A swap that cannot apply answers 409 swap-refused with a reason and a sentence for staff, and nothing changes: different resource types, different business days, the same resource, a booking that is not Pending or Confirmed, a booking waiting in the table pool (assign it a table instead), a table of an automatic merge, an open QR tab on either table, a party that does not fit its new resource, an overlap with another booking there, different hourly prices while a clock runs, or a stale expectation. An unknown reference, or one of another venue, is a 404; a resource type the plan does not include is a 403.