How to add a user to a Wix Bookings session using code?

Product:
I am using Wix Editor

What are you trying to achieve:
I am trying to add user in existing calendar session for a service using backend velo code and What’s going on is that
Wix does not expose a built-in Velo backend API method like querySessions or createBooking.

The Bookings API v2 (https://www.wixapis.com/bookings/v2) is a REST API meant to be called via HTTP requests with an API key or OAuth token.

But calling it directly from Velo using fetch() fails because Wix blocks these requests or requires authentication that you cannot do easily with API keys from inside Velo backend code.

The official Velo wix-bookings-backend module has only very limited functions, none for advanced session querying or booking creation.

What have you already tried:
I have tried Wix buildin methods for Bookings.
Wix does not expose a built-in Velo backend API method like querySessions or createBooking.
I have also tried calling REST api for booking using APi key
The Bookings API v2 (https://www.wixapis.com/bookings/v2) is a REST API meant to be called via HTTP requests with an API key or OAuth token.

But calling it directly from Velo using fetch() fails and API is sending HTML response 404 instead of JSON
The official Velo wix-bookings-backend module has only very limited functions, none for advanced session querying or booking creation.

Generally speaking, we now encourage the use of SDK within sites. Bookings found here.

Since it’s run within the context of a Wix site, the OAuth etc is handled for you, simply need to call the methods etc.

The SDK is fairly extensive with it’s methods :slight_smile:

1 Like