> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: updateReservation(_id: string, reservation: UpdateReservation, options: UpdateReservationOptions) # Method package: wixTableReservationsV2 # Method menu location: wixTableReservationsV2 --> reservations --> updateReservation # Method Link: https://dev.wix.com/docs/velo/apis/wix-table-reservations-v2/reservations/update-reservation.md # Method Description: 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. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Update a reservation (backend) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { reservations } from 'wix-table-reservations.v2'; import { elevate } from 'wix-auth'; /* 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 const myUpdateReservationFunction = webMethod(Permissions.Anyone, async (reservationId, reservation, options) => { const elevatedUpdateReservation = elevate(reservations.updateReservation); try { const result = await elevatedUpdateReservation(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" * } */ ``` ## Update a reservation (dashboard page) ```javascript import { reservations } from 'wix-table-reservations-v2'; import { myUpdateReservationFunction } from 'backend/reservations.jsw'; /* 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"] * } */ myUpdateReservationFunction(reservationId, reservation, options) .then((updatedReservation) => { const startDate = updatedReservation.details.startDate; const partySize = updatedReservation.details.partySize; console.log('Success! Updated reservations:', updatedReservation); return updatedReservation; }) .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" * } */ ``` ---