Get Staff availability based on given date

Question:
I am using wix bookings to book the events.
I have 3 staffs .
I wanted to know on end user selected date, Which staff is booked or available.
And am collecting booking date from signup form.

So, that i can show only available staffs to User.
I have tried

this api on backend code (aModule.jsw). and am getting .

Error Message :
“message”:

“result : {“details”:{“applicationError”:{“description”:“Access is denied. You may not have the appropriate permissions”,“code”:“1”,“data”:{}}}}”

Please guide me where am missing or any other suggestions are welcome.

Thanks in Advance!

Product:
Wix Bookings

What are you trying to achieve:
I want to give my site members access to specific content based on my staff’s availability and their chosen event date.

What have you already tried:

Additional information:
Thanks in Advance.
Have a thankful day ahead.!

If you need to see which staff is available during a specific time, you can use the getServiceAvailability() from the Wix Bookings Frontend API.

This method allows you to pass in a service ID (based on the booking service the user is requesting), as well as a optional AvailabilityOptions parameter which lets you set the search availability at a specific date range.

You can then use the returned staffMemberId items and the associated information in the Bookings/Staff collection to display options to the user.

I recommend also checking out the following booking sample flow.