This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Updates a reservation.
Including the fields status
, source
, reservation.details.tableIds
, reservation.details.endDate
, ignoreReservationLocationConflicts
, and ignoreTableCombinationConflicts
in the request requires additional permissions. See this API's Introduction article for more information.
Each time the reservation is updated, revision increments by 1. The existing revision must be included when updating the reservation. This ensures you're working with the latest reservation information, and it prevents unintended overwrites.
You can only call this method when authenticated as a Wix app or Wix user identity.
function updateReservation(
_id: string,
reservation: UpdateReservation,
options: UpdateReservationOptions,
): Promise<Reservation>;
Reservation ID.
Reservation information to update.
Options for updating the reservation.
import { reservations } from "@wix/table-reservations";
/* Sample reservationId value: "1e3db995-5614-4748-8903-cbe7c74c5753"
*
* Sample reservationObject value:
* {
* "details": {
* "reservationLocationId": "fab8cc1f-31cf-462f-b5bb-392594624bf2",
* "startDate": new Date("2024-12-18T15:30:00Z"),
* "endDate": new Date("2024-12-18T16:30:00Z"),
* "partySize": 3
* },
* "reservee":{
* "phone":"+972555555555",
* "firstName":"John"
* },
* "revision": "23"
* }
*
* Sample options value:
* {
* "ignoreTableCombinationConflicts":["RESERVED", "TOO_BIG"],
* "ignoreReservationLocationConflicts":["PARTY_PACING"]
* }
*/
export async function myUpdateReservationFunction(
reservationId,
reservation,
options,
) {
try {
const result = await reservations.updateReservation(
reservationId,
reservation,
options,
);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "status": "RESERVED",
* "source": "ONLINE",
* "details": {
* "reservationLocationId": "fab8cc1f-31cf-462f-b5bb-392594624bf2",
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ],
* "startDate": "2024-12-18T15:30:00.000Z",
* "endDate": "2024-12-18T16:30:00.000Z",
* "partySize": 3
* },
* "reservee": {
* "firstName": "John",
* "email": "pedro.doe@mail.com",
* "phone": "+972555555555"
* },
* "revision": "24",
* "migrationNotes": [],
* "tablesWithReservationConflicts": [
* {
* "tableId": "1ed802ae-708f-4da6-9177-54c3df5d3dd5",
* "reservationIds": [
* "1c98f3af-f5e1-47b8-b935-1426345652d8"
* ]
* }
* ],
* "_id": "1e3db995-5614-4748-8903-cbe7c74c5753",
* "_createdDate": "2024-01-22T07:25:51.008Z",
* "_updatedDate": "2024-02-07T08:46:57.544Z"
* }
*/
There is 1 error with this status code.
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.