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 location. Supports partial updates.
Each time the reservation location is updated, revision
increments by 1. The existing revision must be included when updating the reservation location. This ensures you're working with the latest reservation location information, and it prevents unintended overwrites.
You cannot use this endpoint to change a reservation location's location
object. Attempting to do so will cause the server to return an application error.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function updateReservationLocation(
_id: string,
reservationLocation: UpdateReservationLocation,
options: UpdateReservationLocationOptions,
): Promise<ReservationLocation>;
Reservation location ID.
Reservation location information to update.
This function call requires elevation to get the necessary permissions
import { Permissions, webMethod } from "wix-web-module";
import { reservationLocations } from "wix-table-reservations.v2";
import { elevate } from "wix-auth";
/* Sample reservationLocationId value: 'fab8cc1f-31cf-462f-b5bb-392594624bf2'
*
* Sample reservationLocationObject value:
* {
* "revision": "11",
* "configuration": {
* "onlineReservations": {
* "minimumReservationNotice": {
* "number": 40,
* "unit": "MINUTES"
* },
* "onlineReservationsEnabled": false
* }
* }
* }
*/
export const myUpdateReservationLocationFunction = webMethod(
Permissions.Anyone,
async (reservationLocationId, reservationLocationObject) => {
const elevatedUpdateReservationLocation = elevate(
reservationLocations.updateReservationLocation,
);
try {
const result = await elevatedUpdateReservationLocation(
reservationLocationId,
reservationLocationObject,
);
return result;
} catch (error) {
console.error(error);
// Handle the error
}
},
);
/* Promise resolves to:
* {
* "revision": "12",
* "location": {
* "name": "Nemal Tel Aviv Street",
* "fax": "",
* "timeZone": "Europe/Dublin",
* "email": "",
* "phone": "",
* "address": {
* "formatted": "Tel Aviv Port, Nemal Tel Aviv Street, Tel Aviv, Israel",
* "location": {
* "latitude": 32.0972612,
* "longitude": 34.77376549999999
* },
* "streetAddress": {
* "name": "Nemal Tel Aviv Street",
* "number": "",
* "apt": ""
* },
* "city": "Tel Aviv-Yafo",
* "country": "IL"
* },
* "businessSchedule": {
* "periods": [
* {
* "openDay": "SUNDAY",
* "openTime": "00:00",
* "closeDay": "MONDAY",
* "closeTime": "00:00"
* },
* {
* "openDay": "THURSDAY",
* "openTime": "00:00",
* "closeDay": "SUNDAY",
* "closeTime": "00:00"
* }
* ],
* "specialHourPeriod": []
* },
* "_id": "f1f59093-6842-45a4-b9d1-106429ec8313"
* },
* "configuration": {
* "onlineReservations": {
* "seatPacing": {
* "number": 11,
* "enabled": false
* },
* "partyPacing": {
* "number": 6,
* "enabled": true
* },
* "partiesSize": {
* "min": 1,
* "max": 6
* },
* "partySize": {
* "min": 1,
* "max": 6
* },
* "minimumReservationNotice": {
* "number": 40,
* "unit": "MINUTES"
* },
* "defaultTurnoverTime": 90,
* "turnoverTimeRules": [],
* "turnoverRules": [],
* "businessSchedule": {
* "periods": [
* {
* "openDay": "SUNDAY",
* "openTime": "00:00",
* "closeDay": "TUESDAY",
* "closeTime": "00:00"
* },
* {
* "openDay": "WEDNESDAY",
* "openTime": "00:00",
* "closeDay": "THURSDAY",
* "closeTime": "00:00"
* },
* {
* "openDay": "FRIDAY",
* "openTime": "00:00",
* "closeDay": "SUNDAY",
* "closeTime": "00:00"
* }
* ],
* "specialHourPeriod": []
* },
* "onlineReservationsEnabled": false
* },
* "reservationForm": {
* "customFieldDefinitions": [
* {
* "name": "Allergies",
* "required": false,
* "_id": "f4283b2d-6340-4cf9-bae7-8769e6b62127"
* }
* ]
* },
* "myReservationsFields": [
* {
* "fieldType": "TABLE",
* "shown": true
* },
* {
* "fieldType": "START_DATE",
* "shown": true
* },
* {
* "fieldType": "END_DATE",
* "shown": true
* },
* {
* "fieldType": "CREATED_DATE",
* "shown": true
* },
* {
* "fieldType": "UPDATED_DATE",
* "shown": true
* },
* {
* "fieldType": "PARTY_SIZE",
* "shown": true
* },
* {
* "fieldType": "FIRST_NAME",
* "shown": true
* },
* {
* "fieldType": "LAST_NAME",
* "shown": true
* },
* {
* "fieldType": "EMAIL",
* "shown": true
* },
* {
* "fieldType": "PHONE",
* "shown": true
* },
* {
* "fieldType": "ADDITIONAL_INFO",
* "shown": true
* },
* {
* "fieldType": "TEAM_MESSAGE",
* "shown": true
* },
* {
* "fieldType": "STATUS",
* "shown": true
* },
* {
* "fieldType": "CUSTOM_FIELD",
* "customFieldId": "f4283b2d-6340-4cf9-bae7-8769e6b62127",
* "shown": false
* }
* ],
* "tableManagement": {
* "tableDefinitions": [
* {
* "name": "Small table",
* "seatsMin": 1,
* "seatsMax": 4,
* "isActive": true,
* "_id": "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* },
* {
* "name": "Big table",
* "seatsMin": 3,
* "seatsMax": 6,
* "isActive": true,
* "_id": "2c8aed3a-20c5-404c-b075-84a92f90a996"
* }
* ],
* "deletedTableDefinitions": [],
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5",
* "2c8aed3a-20c5-404c-b075-84a92f90a996"
* ],
* "seatsMin": 7,
* "seatsMax": 10,
* "isActive": true,
* "_id": "6df9a875-d30d-4c0f-9faa-0a5ae18cd6f6"
* }
* ]
* }
* },
* "default": true,
* "archived": false,
* "_id": "fab8cc1f-31cf-462f-b5bb-392594624bf2",
* "_createdDate": "2023-07-10T09:06:07.507Z",
* "_updatedDate": "2024-01-10T11:13:37.920Z"
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.