Api: display next dates with availability for a set or a specific item

on our website, in addition to the embedded calendar and booking interface, we are displaying a list of future departures with availability like this:

I have found a way to do this, however it seems quite inefficient so I wonder if the API could be adapted to make this easier.

What I am doing at the moment is :

1. querying `item/cal` passing the categories I want and the date (from now to some months in the future)2. what I get back is a list of all possible dates, then I filter out the "emtpy" ones, then I get the ones with some availability and do a request to `item` for each of those.3. with this info I then populate my markup

I have cached this and I am clearing the cache with webhooks, however when not cached this takes quite a long time.

Is there another way that I am missing?

Could the Api be adapted to contain this type of information? as in "give me next dates with availability for this list of items / category", instead of having to do a lot of requests?

thank you for your attention!

Mario.

Comments

The item endpoint supports a show_upcoming=1 parameter, which you can use on the item/{item_id} query to display a list of upcoming available dates. By default, it will return the next 4 available dates from the specified start_date, within a given upcoming window. The resulting query would look something like item/{item_id}?start_date=20180801&show_upcoming=1.

There is no option to get more upcoming dates with a single query. If you need more dates, then you could perform multiple queries, using the day after the last returned upcoming date as the start date for your next query. But then you are back to potentially making many requests to get the needed information.

Some endpoints/parameters are not publicly documented. This could be related to the intended use of the parameter, potential problems it could cause, or how performance heavy it is. There is no other source of documentation for the API.

There is no way to add this option to a single Droplet, but under Manage > Layout > Booking Page > Upcoming, you can set your booking page to automatically advance to the next available date. Note that you will need to disable both the 'show unavailable' and 'show sold-out' items in order to enable this option.