2. Options#

During the Options steps the options for a given product in a specific date get requested and selected one by one, until all of the information to compute the price is collected. As soon as Get Options is called for a product and a date, an Availability item with a unique ID, is created on Amadeus Discover side. This Availability item is the object that will be used in the following steps of the booking flow, defining the key elements for booking creation : date, options, participants. Depending on activities, the number of options levels might vary. Some activities have no levels of options, and can be priced straight away. Some other might have multiple levels of options to handle before being able to price the activity. This loop is handled trough two endpoints:

getOptions#

Given a date and a product id, this endpoint initiates a new availability item and returns its ID along with first level of option that needs selecting. This endpoint only needs to be called once no matter the number of options a product has.


Path

GET /booking-flow/v1/products/:productId/availabilities/:date/options


Input body example

none

Output body example
{
     "id": "01d0597b-a819-478b-b32d-f99290b70e88",
     "availabilityDate": "2023-12-19",
     "availabilityOptions": [
         {
             "label": "Ticket Type",
             "level": "0",
             "id": "24deeda6-bcda-4c04-9659-e2ca2b2beedc",
             "optionChoices": {
                 "528446": "Eiffel ,2 Day Bus Pass &Cruise"
             }
         }
     ],
     "isOptionStepCompleted": false,
     "isPricingStepCompleted": false
 }

setOptions#

Given the availability id and the value to set for an option, it persists the answer in the availability and returns an updated list of options, including the next option to select (if any).


Path

PUT /booking-flow/v1/products/:productId/availabilities/:availabilityId/options


Input body example
{
    "optionId" : "24deeda6-bcda-4c04-9659-e2ca2b2beedc",
    "value": "528446"
}
Output body example
{
    "id": "01d0597b-a819-478b-b32d-f99290b70e88",
    "availabilityDate": "2023-12-19",
    "availabilityOptions": [
        {
            "label": "Ticket Type",
            "level": "0",
            "id": "24deeda6-bcda-4c04-9659-e2ca2b2beedc",
            "selectedOptionId": "528446",
            "optionChoices": {
                "528446": "Eiffel ,2 Day Bus Pass &Cruise"
            }
        },
        {
            "label": "Start Time",
            "level": "1",
            "id": "01d28c41-0b26-4d3a-a0ec-229125e07c63",
            "optionChoices": {
                "420013_20231219": "12:00"
            }
        }
    ],
    "isOptionStepCompleted": false,
    "isPricingStepCompleted": false
}

Note

  • Here see how answering a level 0 option, gives a subsequent options to be set. So next call will be to set the new option level 1.

  • This endpoint needs to be called once for every option in the availability.


Options can be of two types, depending on their dataType property.

  • OPTIONS: a choice between a fixed number of options, identified by their key when setting them in the setQuestion. This type of options typically needs to be proposed to users through a selection list.

  • TEXT: a free text option, that could contain any string. This type of options typically needs to be proposed to users through a free text box.


Be aware that creating an availability does not imply an hold process.

The same availability could be worked on for up to 1h but a prolonged period of time between availability check and booking confirmation might lead to missing availability error at Confirm stage. If more than 1h is needed we recommend to restart the full flow with a new availability ID.

The option step is considered completed when flag isOptionStepCompleted is set to true in the calls responses, which means all required selections have been made.

Note

  • An extremely limited number of products has no selectable option. When that’s the case, the getOptions will return an empty availabilityOptions array and the isOptionStepCompleted flag already set to true