1. Availability#

In the Availability step, the flow begins by retrieving a list of dates in which the selected product is available. The chosen date will then be used as input in the following step. To accomplish this, the Consumer API offers two different endpoints to accommodate different architectural needs.

getAvailability#

Given a date range and product id, an array of dates where the product is available is returned. If no availability is found within the given range, an empty array is returned.


Path

GET /booking-flow/v1/products/:productId/availabilities?startDate={{startDate}}&endDate={{endDate}}


Input body example

none

Output body example
{
    "availabilityDates": [
        "2023-12-19",
        "2023-12-22",
        "2023-12-23",
        "2023-12-24",
        "2023-12-25",
        "2023-12-26",
        "2023-12-27",
        "2023-12-28",
        "2023-12-29",
        "2023-12-30",
        "2023-12-31",
        "2024-01-01",
        "2024-01-02",
        "2024-01-03",
        "2024-01-04",
        "2024-01-08",
        "2024-01-09",
        "2024-01-10",
        "2024-01-11",
        "2024-01-12",
        "2024-01-13"
    ]
}

getNextAvailability#

Given a product ID, an array is returned containing the first available date for the product, along with all other available dates in the same month, up to a year in the future from the current date. If no dates are available within the next year, an empty array is returned.


Path

GET /booking-flow/v1/products/:productId/availabilities/next


Input body example

none

Output body example
{
    "availabilityDates": [
        "2024-12-19",
        "2024-12-22",
        "2024-12-23",
        "2024-12-24",
        "2024-12-25",
        "2024-12-26",
        "2024-12-27",
        "2024-12-28",
        "2024-12-29",
        "2024-12-30",
        "2024-12-31"
    ]
}

Note

  • This is a call made on June 2024 for a product available only after 19th of December 2024.

  • The use of the getNextAvailability endpoint is recommended if the getAvailability endpoint does not return results for the coming month.

  • In a UI, a call to the getNextAvailability endpoint should be associated with an explicit user input to avoid confusion.

  • As you can see the output is the same as the get availability endpoint.

  • You will note that the list of dates stops on the last day of the month.


Cache mechanism: Caching of availability elements is highly recommended to optimize the performances. Data from these calls can be safely cached for up to one hour.