Generating a dynamic list of dates [Backend] between 2 dates range in an API Workflow (GetYourGuide integration)

Hi everyone :waving_hand:

I’m working on a project for a tour company, where I’m building a new website that integrates with the GetYourGuide API.

Specifically, I’m implementing the GET get-availabilities endpoint.
When GetYourGuide sends a request, it includes the following parameters:

  • productId

  • fromDateTime

  • toDateTime

The fromDateTime and toDateTime values usually represent a date range (for example, 5 days).

What I need to do is:

  1. Receive these two dates,

  2. Generate a list of all days between them (day per day),

  3. Check tours sessions availability for each day, and

  4. Return that list through “Return data from API” by JSON.

The challenge:
Bubble doesn’t seem to allow using a date as an indexed element (for example, to loop or increment a date one day at a time), and this type of loop is not allowed at Backend Workflow too.
I can’t find a native way to iterate through a date range dynamically inside an API Workflow and return a result for each day.

What GetYourGuide expects as a response

Here’s an example of the response format I need to send back:

:right_arrow: If the range includes only one day:

:right_arrow: If the range includes two days (2020-12-01 and 2020-12-02):

I’ve already considered alternatives, such as storing each reserved day in the database in JSON format. However, this approach is more useful if we only need to return the days with reservations, not all days within a date range, which is what GetYourGuide requires.

Hi, follow the given steps :
in the api setup, send the from and to dates,

Then in the backend - take the date parameters, and create a custom flow to create a date range.
Then use the date range to find the dates within this range.

Thanks a lot for your reply! :folded_hands:

I think there might have been a small misunderstanding, I’m not trying to return existing bookings from my database or API.

What I actually need is to generate and return all dates within the requested date range (fromDateTimetoDateTime), even if there are no bookings on some of those days.

In other words, the API response must include each day in the range, along with its availability status:

  • If a date already has bookings, I can calculate and return the remaining availability for that day.

  • If a date has no bookings, it should still appear in the response as fully available (with maximum capacity).

The challenge is that Bubble doesn’t seem to provide a native way to loop through all dates between two given dates and build a structured list dynamically — especially when using “Return data from API”.

That’s the part I’m trying to figure out.

Got it.

This still gives you the information that the dates not included do not have the bookings.

You can use the 1T List of Dates Plugin, in the frontend, to populate a repeating group with the list lenght based on the date range, show the bookings count for the received dates and availability for the rest.

Yes, I can definitely do that on the frontend using a repeating group, I’ve already managed to generate date ranges (e.g. with a Dates Generator) and check bookings from the database without issues, but this is not the case.

In this case, the goal is to handle everything on the backend.
The GetYourGuide API sends a request (with fromDateTime and toDateTime), and I need to respond automatically from a backend workflow, without any frontend interaction.

When this process is done on the frontend, it only works while the page is open, but this API call should be processed entirely on the server side (backend), so it can return the availability data to GetYourGuide directly.


(here is the frontend calendar with dates range)

bubble has very little in the way to do things linearly. This is probably my biggest frustration. Anything that you want to force linearly you can use a recursive workflow. You send it your start date, how many dates you want, and then add the current date +1 to a list. Do this recursively and return the list at the end. If you havent done recursion before it can be tricky, but I suggest you ask AI to help you.

It has to be a backend workflow. And yes this is very heavy weight.

As other people have said you can have a hidden repeating group to do it too. You could also put in a javascript object and do it directly in javascript