Migrated from Redmine #885 | Author: Erik Borge
Status: New | Priority: High, I’m very impatient | Created: 2022-05-27
Hi.
I’m making a custom booking flow by using the REST API on a website where I need to show a calendar with days where there are available slots. That means I want to disable days where there are no available slots, so the user can only click on days with available slots. For this, I have two pieces of relevant information:
https://user-api-v2.simplybook.me/admin/schedule - Tells me if a given day from a range of dates is a working day (is_day_off): true/false. Here, I can ask for a range of dates, so I could for example find all working days in a month.
https://user-api-v2.simplybook.me/admin/schedule/available-slots - Gives me available slots for a given day. Here, I cannot ask for a range of dates.
The problem is that I cannot directly get all the information I need from one API call. That is, available slots for, let’s say, a month at a time, because the /schedule/available-slots endpoint gives me only slots for a single day. Right now, the only solution I see is to first get all dates with “is_day_off”: false, and for all those days get available slots in a separate call for each day. It could work, but as a result I would need to make like 20 API calls for each month the user navigates to in my calendar, which would generate a lot of unnecessary API calls and potentially generate long loading times on my page to wait for all the calls to go through.
Is there a solution for gettting available slots for a range of dates? Or do I need to make a lot of API calls to get the information I need? I would think this is a pretty normal functionality to have, so if it doesn’t exist it could be an idea to implement it.
Thanks
Erik