Caching + Shopping Cart
Introduction
The NDC API includes a distributed Offer-/Order-cache, which is necessary to enable the “shopping-cart” booking flow.
The cache replaces the need to send the complete data with every message with the simple usage of IDs.
Cache Flow
The NDC structure is fully relying on Offers and Orders. These items all have individual IDs to be referenced in following requests.
For example an IATA_AirShoppingRS returns several Offers that look like as follows (simplified):
<Offer>
<OfferID>OFb8295236-7a41-11ea-b330-bfbb959286d4</OfferID>
<OfferItem>
<OfferItemID>OFIb8295236-7a41-11ea-b330-bfbb959286d41</OfferItemID>
<Service>
<PaxRefID>PX1</PaxRefID>
<ServiceAssociations>
<PaxJourneyRefID>FL1</PaxJourneyRefID>
</ServiceAssociations>
<ServiceID>SV1</ServiceID>
</Service>
</OfferItem>
</Offer>
This structure shows the following data:
OfferID
OfferItemID
associated flight
For each IATA_AirShoppingRS this data is stored in the cache. So in a subsequent request (e.g. IATA_OfferPriceRQ), only the IDs have to be referenced (simplified):
<PricedOffer>
<SelectedOffer>
<OfferRefID>OFb8295236-7a41-11ea-b330-bfbb959286d4</OfferRefID>
<SelectedOfferItem>
<OfferItemRefID>OFIb8295236-7a41-11ea-b330-bfbb959286d41</OfferItemRefID>
<PaxRefID>PX1</PaxRefID>
</SelectedOfferItem>
</SelectedOffer>
</PricedOffer>
The NDC API now can retrieve the selected Offer from the cache and has the correct data to request the flight to the airline.
This provides a much more simplified shopping flow for the client, because only the selected IDs have to be stored and send in the following requests instead of the full data.
The Cache also enables the possibility to continue shopping based on previous Orders. In this case, the client has to retrieve the booking once to load the data of the booking into the cache. Please note, that after a booking is created, this will be done automatically. So after a create, no additional retrieve is required, as long as the following communication is done within the cache period.
Using an existing order, the user can shop for ancillaries based on the data of this order.
Samples for all this cache flows will be added to the NDC XML Samples.
Retrieve Shopping Cart Offers
Offers can be placed in the shopping cart, this is done by performing an IATA_OfferPriceRQ. Once this has been done, the offer is bundled and can be retrieved again later (according to business rules, see next chapter). To retrieve these Offers, there are 2 possibilities:
Use an IATA_OfferPriceRQ with the offer data, that was returned in the previous IATA_OfferPriceRS, used to store the offer in the cart. With that, you will receive another IATA_OfferPriceRS with the data from the shopping cache and a reprice.
If the offer data, that was returned in the previous IATA_OfferPriceRS is not known in detail, but just the OfferID of the priced offer on top level is known, there is another possibility to retrieve your offer. As the IATA XSD-Schemas do not provide an “OfferRetrieve”-Request, there is an additional JSON-endpoint for this case. For connection details, see Accessing the NDC.ONE APIs, for details about the request, see OfferRetrieveRQ
Cache times
The NDC API features 3 different sections inside the cache: Shopping, Offer and Order. These sections are seperated to enable the possibility of having different cache durations.
The duration of how long Offers/Orders will be cached, can be configured individually for each customer.
The default cache times are:
Shopping (Flight-, Seat- and Service-Offers): 20 Minutes
Offer (Offers returned by IATA_OfferPriceRS): 30 Minutes
Order (Orders returned by IATA_OrderViewRS): 30 Minutes
Depending on the underlying reservation system, the times can vary according to the applied business rules. Please connect to your corresponding airline partner to get a detailed view on your cache time.