[#402] Issues with getAvailableTimeIntervals

Migrated from Redmine #402 | Author: Raffaele Millo
Status: New | Priority: Immediate, there is BUG! | Created: 2019-08-01


getAvailableTimeIntervals will only return time intervals available within a month from “dateFrom” even if the value of “dateTo” is further in the future.
E.g. set dateFrom to 1 August 2019, and dateTo to 1 August 2020: getAvailableTimeIntervals seems to be returning time intervals up to 1 September 2019 only.

In addition, the “count” parameter doesn’t seem to work.
E.g. you don’t set “count” getAvailableTimeIntervals and get 32 results; if you now set “count” to 10 you still get 32 results.

Redmine Admin wrote:

yes, it is correct behaviour, this function is limited to one month results only to prevent server overload and possible DDoS attacks

Raffaele Millo wrote:

I see, thanks for the info.

( Could you add this to the documentation page, as it’s not clear from the description? => Company public service methods - Company public service methods - SimplyBook.me )

This behavior is causing some problems to our application, as if we wanted to display the first 10 available time intervals (irregardless of which date is selected) we’d need to repeatedly call the API.

Would it be possible to change the method behavior to return, say, the first 30 results?
Or in alternative, would it be possible to change this behavior and and extend the time limit to, say, 3 months?

If this is not possible, is there an endpoint we can use to obtain information on the first available time interval? Once we have the first available interval Start date/time we can then call getAvailableTimeIntervals using that as start date

Also, could you confirm if the issue with the “count” parameter I reported is also expected behavior?

In addition, the “count” parameter doesn’t seem to work.
E.g. you don’t set “count” getAvailableTimeIntervals and get 32 results; if you now set “count” to 10 you still get 32 results.

Redmine Admin wrote:

Hi,

You can use REST API for this

https://COMPANY_LOGIN.simplybook.me/v2/booking/first-working-day?location=1&provider=1&service=1

where you need to pass ids of locatrion (if Locations custom feature is enabled), provider and service
provider id can be any (e.g. provider=any) if ANy employee custom feature is enabled

Redmine Admin wrote:

Or just call this API method

Raffaele Millo wrote:

I’m not sure we can we can use getFirstWorkingDay as there’s no eventId we can pass: getFirstWorkingDay only has unitId as parameter, but we use getAvailableTimeIntervals by also passing “eventId”

Redmine Admin wrote:

eventId is id of service, you can pass it to this function:

getFirstWorkingDay({"event_id":1,"unit_group_id":1});