POST

Set Service Locations


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Replaces the list of the locations (SDK | REST) where the business offers the service.

Consequences for customers

Removing a service location may impact existing sessions and their participants. If you remove at least one service location, you must specify removedLocationSessionsAction to indicate what happens to all future sessions scheduled at this location.

  • Keep existing location: If you want to retain future sessions at their originally scheduled location, specify {"removedLocationSessionsAction.action": "KEEP_AT_CURRENT_LOCATION"}. This ensures nothing changes for the customer, but the business must be able to provide access to the removed location in the future.
  • Update location: If you want to update the location for future sessions scheduled at the removed location, specify {"removedLocationSessionsAction.action": "MOVE_TO_LOCATION"} and moveToLocationOptions.newLocation.

You can't mix and match to keep some sessions at the previous location while moving other sessions to an updated location.

Past session details aren't changed, no matter which option you choose for future sessions.

Future sessions scheduled for a location defined by the customer are also not updated.

Specify location details

Depending on whether the new or updated location is a business or custom location, you need to specify different fields.

  • Business location: Specify the relevant location ID (SDK | REST) in locations.business.id.
  • Custom location: Specify the complete address object as locations.custom.address.

Participant notifications

You can specify a participantNotification.message that's immediately send to all customers who had booked at a changed location. Ensure participantNotification.notifyParticipants is set to true to send the message.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage Bookings - all permissions
Manage Bookings
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/_api/bookings/v2/services/{serviceId}/locations

Path Params
serviceIdstringRequired

ID of the service.

Body Params
locationsArray <Location>RequiredmaxItems 100

List of locations replacing existing service locations. Omitting an existing location removes it from the service. Specify removedLocationSessionsAction to determine the handling of future sessions scheduled at that location.


removedLocationSessionsActionRemovedLocationSessionsAction

The action to perform on sessions currently set to a removed location. For example, move existing sessions to a new specified location. If not specified, sessions will not be moved to a new location.


participantNotificationParticipantNotification

Whether to notify participants about the change of location, and an Optional custom message. The notification is sent only to participants of sessions that are affected by the change.

Response Object
serviceService

The updated service with the newly set locations.

Set service locations, while moving existing sessions to a new location
Request
cURL
curl -X POST 'https://www.wixapis.com/bookings/v2/services/353aa3b7-00ef-42bd-86ff-720d7ef60443/locations' \ -H 'Authorization: <AUTH>' \ -d '{ "serviceId": "353aa3b7-00ef-42bd-86ff-720d7ef60443", "locations": [{ "id": "e1ffe959-07a3-4000-be8c-79bf6d28cc2e", "type": "BUSINESS" }], "participantNotification": { "notifyParticipants": true, "message": "Message to participants" }, "removedLocationSessionsAction": { "action": "MOVE_TO_LOCATION", "moveToLocationOptions": { "newLocation": { "id": "e1ffe959-07a3-4000-be8c-79bf6d28cc2e" } } } }'
Response
JSON
{ "service": { "id": "353aa3b7-00ef-42bd-86ff-720d7ef60443", "type": "CLASS", "sortOrder": 0, "name": "Dog Yoga", "description": "Get ready to downward dog with your furry best friend! In this unique class, you and your pup will strike a pose and find your zen. With a mix of stretching, breathing exercises, and playtime, this class is sure to be a tail-waggin' good time. Whether you're a seasoned yogi or a pup-tastic beginner, this class is pawsitively perfect for all levels. Don't forget to bring your sense of humor, as there's sure to be a few doggy distractions and playful paw-terruptions along the way. Namaste!", "tagLine": "Unleash your zen with downward dog and a wagging tail in our pup-poseful yoga class!", "defaultCapacity": 50, "media": { "items": [], "mainMedia": { "image": { "id": "nsplsh_4d7639686a6e4555485234~mv2_d_3024_4032_s_4_2.jpg", "url": "nsplsh_4d7639686a6e4555485234~mv2_d_3024_4032_s_4_2.jpg", "height": 4032, "width": 3024, "filename": "nsplsh_4d7639686a6e4555485234~mv2_d_3024_4032_s_4_2.jpg" } } }, "hidden": false, "category": { "id": "7b5b9862-490f-491c-8477-d39baed078a1", "name": "Best for fun dogs", "sortOrder": 1 }, "form": { "id": "00000000-0000-0000-0000-000000000000" }, "payment": { "rateType": "FIXED", "fixed": { "price": { "value": "15", "currency": "USD" } }, "pricingPlansIds": [], "options": { "online": true, "inPerson": false, "deposit": false, "pricingPlan": false } }, "onlineBooking": { "enabled": true, "requireManualApproval": false, "allowMultipleRequests": false }, "staffMemberIds": [], "conferencing": { "enabled": true }, "locations": [ { "id": "e1ffe959-07a3-4000-be8c-79bf6d28cc2e", "type": "BUSINESS", "calculated_address": { "country": "US", "subdivision": "TX", "city": "Dallas", "postal_code": null, "formatted_address": "Dallas, TX, USA", "hint": null, "geocode": { "latitude": 32.7766642, "longitude": -96.79698789999999 } }, "business": { "id": "2c6c4fb6-b4c2-46d3-916c-3a4c7a80fcc6", "name": "Dallas", "default": true, "address": { "country": "US", "subdivision": "TX", "city": "Dallas", "postal_code": null, "formatted_address": "Dallas, TX, USA", "hint": null, "geocode": { "latitude": 32.7766642, "longitude": -96.79698789999999 } }, "email": "", "phone": "" } } ], "bookingPolicy": { "id": "2a8cbc1b-7968-44e7-899a-d1df1ecbeefe", "revision": "3", "createdDate": "2023-04-11T08:51:43.025Z", "updatedDate": "2023-05-19T11:32:27.930Z", "name": "Default policy", "customPolicyDescription": { "enabled": false, "description": "" }, "default": true, "limitEarlyBookingPolicy": { "enabled": false, "earliestBookingInMinutes": 604800 }, "limitLateBookingPolicy": { "enabled": false, "latestBookingInMinutes": 1440 }, "bookAfterStartPolicy": { "enabled": false }, "cancellationPolicy": { "enabled": true, "limitLatestCancellation": false, "latestCancellationInMinutes": 1440 }, "reschedulePolicy": { "enabled": true, "limitLatestReschedule": false, "latestRescheduleInMinutes": 1440 }, "waitlistPolicy": { "enabled": false, "capacity": 10, "reservationTimeInMinutes": 10 }, "participantsPolicy": { "enabled": false, "maxParticipantsPerBooking": 1 }, "resourcesPolicy": { "enabled": false, "autoAssignAllowed": false } }, "schedule": { "id": "8acb939f-34d1-4ac9-8564-b24c29e11ef7", "firstSessionStart": "2023-02-13T15:30:00Z" }, "supportedSlugs": [ { "name": "dog-yoga", "custom": false, "createdDate": "2023-02-09T16:40:45.267Z" } ], "mainSlug": { "name": "dog-yoga", "custom": false, "createdDate": "2023-02-09T16:40:45.267Z" }, "urls": { "servicePage": { "relativePath": "/service-page/dog-yoga", "url": "https://example.com/services-v2" }, "bookingPage": { "relativePath": "/book-online/dog-yoga/book", "url": "https://example.com/services-v2" }, "calendarPage": { "relativePath": "/booking-calendar/dog-yoga", "url": "https://example.com/services-v2" } } } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Event TriggersThis method triggers the following events:
Did this help?