Get available calendar slots

I’m using the API to create bookings. I can also get all the bookings that I made with the API. This all works fine. But I obviously have a question. I’ll try to explain what I currently have a first.

I have a web page where a user can “book” a timeslot to make an appointment with us. So a user can pick a day in the coming week, and after that he can choose a certain time.

So for example, a user can pick a day, lets say: “Wednesday”.
He is then presented with timeslots, each of 30 minutes (like it is configured on the booking calendar):

08:00 - 08:30 (available)
08:30 - 09:00 (available)
0900 - 09:30 (busy)
etc.
16:30 - 17:00 (last available timeslot in a workweek)

So what I basically need to do is render a “calendar” that shows all the booked and available dates.

I can do this by getting booked dates from the API. Then do a foreach loop on a date/time, increment that by 30 minutes and check if that current date/time is in the list of bookings.

But I’d rather get this “calender” from the API if possible instead of doing this manually.

That way, if they ever decide to change the working hours from 09:00 till 18:00, instead of 08:00 till 17:00, I then don’t have to change anything on my side in the code, because the entire calender would come from the API.

Is it possible to get this “calendar” data from the API including all the booked and available timeslots?

@Vivendi great question. We do not yet have our availability endpoint exposed to the public. This is only used internally for the booking engine to function. I will get your feedback submitted as a feature request. One option in the interim is to use either Google Calendar or Microsoft’s API to run a free/busy check on the linked calendars. This adds another layer of complexity, but may be possible to get you something in the interim.

Thanks for the quick feedback and your suggestion. I will look into the Microsoft API for this functionality.

1 Like

It might be worth checking out https://www.cronofy.com/.

I’ve used them for this exact purpose and it was pretty great.