How to guarantee air price quote after PNR creation on Sabre API? - api

I'm trying to create a PNR with "Time to think/Fare lock" option offered by airlines like AF, KLM, LH and more. The idea is to create the PNR to temporarily "block" the price until the time limit is reached (48~72hs) but I don't know how.
I'm able to create the PNR, with CreatePassengerNameRecord, without problems and it returns the retained PriceQuote but the fare is not guaranteed until ticketed and the system will re-price the itinerary with the current fare before ticketing.
Request/response example
CreatePassengerNameRecordRQ
"CreatePassengerNameRecordRQ" : {
"version" : "2.2.0",
"haltOnAirPriceError" : true,
"TravelItineraryAddInfo" : {
"AgencyInfo" : {
"Address" : {
"AddressLine" : "TEST",
"CityName" : "TEST",
"CountryCode" : "FR",
"PostalCode" : "99999",
"StreetNmbr" : "TEST 123"
},
"Ticketing" : {
"PseudoCityCode" : "L4GJ",
"TicketType" : "7TAW"
}
},
"CustomerInfo" : {
"ContactNumbers" : {
"ContactNumber" : [
{
"Phone" : "99999999",
"PhoneUseType" : "A"
}
]
},
"CustLoyalty" : [],
"Email" : [
{
"Address" : "test#gmail.com"
},
{
"Address" : "testRes#gmail.com"
}
],
"PersonName" : [
{
"NameNumber" : "1.1",
"PassengerType" : "ADT",
"GivenName" : "TEST",
"Surname" : "TEST"
}
]
}
},
"AirBook" : {
"HaltOnStatus" : [
{
"Code" : "HL"
},
{
"Code" : "KK"
},
{
"Code" : "LL"
},
{
"Code" : "NN"
},
{
"Code" : "NO"
},
{
"Code" : "UC"
},
{
"Code" : "US"
}
],
"OriginDestinationInformation" : {
"FlightSegment" : [
{
"DepartureDateTime" : "2021-02-17T13:15:00",
"ArrivalDateTime" : "2021-02-17T13:45:00",
"FlightNumber" : "1780",
"NumberInParty" : "1",
"ResBookDesigCode" : "G",
"Status" : "NN",
"DestinationLocation" : {
"LocationCode" : "LHR"
},
"MarketingAirline" : {
"Code" : "AF",
"FlightNumber" : "1780"
},
"OriginLocation" : {
"LocationCode" : "CDG"
}
},
{
"DepartureDateTime" : "2021-02-26T11:30:00",
"ArrivalDateTime" : "2021-02-26T13:50:00",
"FlightNumber" : "1581",
"NumberInParty" : "1",
"ResBookDesigCode" : "X",
"Status" : "NN",
"DestinationLocation" : {
"LocationCode" : "CDG"
},
"MarketingAirline" : {
"Code" : "AF",
"FlightNumber" : "1581"
},
"OriginLocation" : {
"LocationCode" : "LHR"
}
}
]
}
},
"AirPrice" : [
{
"PriceComparison" : {
"AcceptablePriceDecrease" : {
"Amount" : 125.3,
"HaltOnNonAcceptablePrice" : true
},
"AcceptablePriceIncrease" : {
"Amount" : 5,
"HaltOnNonAcceptablePrice" : true
},
"AmountSpecified" : 125.3
},
"PriceRequestInformation" : {
"Retain" : true,
"OptionalQualifiers" : {
"MiscQualifiers" : {
"BaggageAllowance" : []
},
"FOP_Qualifiers" : {
"BasicFOP" : {
"Type" : "CK"
}
},
"PricingQualifiers" : {
"ItineraryOptions" : {
"SegmentSelect" : [
{
"Number" : "1",
"RPH" : "1"
},
{
"Number" : "2",
"RPH" : "2"
}
]
},
"PassengerType" : [
{
"Quantity" : "1",
"Code" : "ADT"
}
],
"SpecificFare" : [
{
"FareBasis" : "GS50OALG",
"RPH" : "1"
},
{
"FareBasis" : "XS50OALG",
"RPH" : "2"
}
]
}
}
}
}
],
"SpecialReqDetails" : {
"SpecialService" : {
"SpecialServiceInfo" : {
"AdvancePassenger" : [],
"SecureFlight" : [
{
"PersonName" : {
"NameNumber" : "1.1",
"DateOfBirth" : "1991-01-13",
"Gender" : "M",
"GivenName" : "TEST",
"Surname" : "TEST"
}
}
],
"Service" : [
{
"SSR_Code" : "CTCM",
"PersonName" : {
"NameNumber" : "1.1"
},
"Text" : "0033142890939"
},
{
"SSR_Code" : "CTCE",
"PersonName" : {
"NameNumber" : "1.1"
},
"Text" : "TEST"
}
]
}
}
},
"PostProcessing" : {
"RedisplayReservation" : {
"waitInterval" : 1000
},
"EndTransaction" : {
"Email" : {
"eTicket" : {
"PDF" : {
"Ind" : false
},
"Ind" : false
},
"Ind" : true
},
"Source" : {
"ReceivedFrom" : "TEST"
}
}
}
}
}
CreatePassengerNameRecordRS (partial)
"CreatePassengerNameRecordRS" : {
"ApplicationResults" : {
"status" : "Complete",
"Success" : [
{
"timeStamp" : "2020-11-19T06:29:15.342-06:00"
}
],
"Warning" : [
{
"type" : "BusinessLogic",
"timeStamp" : "2020-11-19T06:29:14.016-06:00",
"SystemSpecificResults" : [
{
"Message" : [
{
"code" : "WARN.SWS.HOST.WARNING_RESPONSE",
"content" : "EndTransactionLLSRQ: TTY REQ PEND"
}
]
}
]
}
]
},
"ItineraryRef" : {
"ID" : "HOKJCQ"
},
"AirBook" : {
"OriginDestinationOption" : {
"FlightSegment" : [
{
"ArrivalDateTime" : "02-17T13:45",
"DepartureDateTime" : "02-17T13:15",
"eTicket" : true,
"FlightNumber" : "1780",
"NumberInParty" : "001",
"ResBookDesigCode" : "G",
"Status" : "NN",
"DestinationLocation" : {
"LocationCode" : "LHR"
},
"MarketingAirline" : {
"Code" : "AF",
"FlightNumber" : "1780"
},
"OriginLocation" : {
"LocationCode" : "CDG"
}
},
{
"ArrivalDateTime" : "02-26T13:50",
"DepartureDateTime" : "02-26T11:30",
"eTicket" : true,
"FlightNumber" : "1581",
"NumberInParty" : "001",
"ResBookDesigCode" : "X",
"Status" : "NN",
"DestinationLocation" : {
"LocationCode" : "CDG"
},
"MarketingAirline" : {
"Code" : "AF",
"FlightNumber" : "1581"
},
"OriginLocation" : {
"LocationCode" : "LHR"
}
}
]
}
},
"AirPrice" : [
{
"PriceComparison" : {
"AmountReturned" : "125.30",
"AmountSpecified" : "125.3"
},
"PriceQuote" : {
"MiscInformation" : {
"BaggageInfo" : {
"SubCodeProperties" : [
{
"SolutionSequenceNmbr" : 1,
"RPH" : 1,
"AncillaryFeeGroupCode" : "BG",
"CommercialNameofBaggageItemType" : "FREE BAGGAGE ALLOWANCE",
"EMD_Type" : "4",
"ExtendedSubCodeKey" : "0DFAAAF"
},
{
"SolutionSequenceNmbr" : 1,
"RPH" : 2,
"AncillaryFeeGroupCode" : "BG",
"CommercialNameofBaggageItemType" : "UPTO50LB 23KG AND62LI 158LCM",
"DescriptionOne" : {
"Code" : "23",
"Text" : "UP TO 50 POUNDS/23 KILOGRAMS"
},
"DescriptionTwo" : {
"Code" : "6U",
"Text" : "UP TO 62 LINEAR INCHES/158 LINEAR CENTIMETERS"
},
"EMD_Type" : "4",
"ExtendedSubCodeKey" : "0GOACAF",
"SizeWeightInfo" : {
"MaximumSizeInAlternate" : {
"Units" : "C",
"content" : "158"
},
"MaximumSize" : {
"Units" : "I",
"content" : "62"
},
"MaximumWeightInAlternate" : {
"Units" : "K",
"content" : "23"
},
"MaximumWeight" : {
"Units" : "L",
"content" : "50"
}
}
},
{
"SolutionSequenceNmbr" : 1,
"RPH" : 3,
"AncillaryFeeGroupCode" : "BG",
"AncillaryService" : {
"SubGroupCode" : "CY",
"Text" : "CARRY ON HAND BAGGAGE"
},
"CommercialNameofBaggageItemType" : "CARRYON HAND BAGGAGE ALLOWANCE",
"EMD_Type" : "4",
"ExtendedSubCodeKey" : "0LNABAF"
},
{
"SolutionSequenceNmbr" : 1,
"RPH" : 4,
"AncillaryFeeGroupCode" : "BG",
"AncillaryService" : {
"SubGroupCode" : "CY",
"Text" : "CARRY ON HAND BAGGAGE"
},
"BookingMethod" : "04",
"CommercialNameofBaggageItemType" : "CABIN BAGGAGE 12KG 1PC 115CM",
"DescriptionOne" : {
"Code" : "12",
"Text" : "UP TO 26 POUNDS/12 KILOGRAMS"
},
"DescriptionTwo" : {
"Code" : "4U",
"Text" : "UP TO 45 LINEAR INCHES/115 LINEAR CENTIMETERS"
},
"EMD_Type" : "4",
"ExtendedSubCodeKey" : "0MRACAF",
"SizeWeightInfo" : {
"MaximumSizeInAlternate" : {
"Units" : "C",
"content" : "115"
},
"MaximumSize" : {
"Units" : "I",
"content" : "45"
},
"MaximumWeightInAlternate" : {
"Units" : "K",
"content" : "12"
},
"MaximumWeight" : {
"Units" : "L",
"content" : "26"
}
}
}
]
},
"HeaderInformation" : [
{
"SolutionSequenceNmbr" : "1",
"DepartureDate" : "2021-02-17",
"Text" : [
"VALIDATING CARRIER - AF",
"CAT 15 SALES RESTRICTIONS FREE TEXT FOUND - VERIFY RULES",
"BAG ALLOWANCE -CDGLHR-NIL/AF",
"1STCHECKED BAG FEE-CDGLHR-EUR45.00/AF/UP TO 50 POUNDS/23 KILOGR",
"AMS AND UP TO 62 LINEAR INCHES/158 LINEAR CENTIMETERS",
"2NDCHECKED BAG FEE-CDGLHR-EUR70.00/AF/UP TO 50 POUNDS/23 KILOGR",
"AMS AND UP TO 62 LINEAR INCHES/158 LINEAR CENTIMETERS",
"BAG ALLOWANCE -LHRCDG-NIL/AF",
"1STCHECKED BAG FEE-LHRCDG-EUR45.00/AF/UP TO 50 POUNDS/23 KILOGR",
"AMS AND UP TO 62 LINEAR INCHES/158 LINEAR CENTIMETERS",
"2NDCHECKED BAG FEE-LHRCDG-EUR70.00/AF/UP TO 50 POUNDS/23 KILOGR",
"AMS AND UP TO 62 LINEAR INCHES/158 LINEAR CENTIMETERS",
"CARRY ON ALLOWANCE",
"CDGLHR LHRCDG-01P/AF",
"01/UP TO 26 POUNDS/12 KILOGRAMS AND UP TO 45 LINEAR INCHES/115",
"LINEAR CENTIMETERS",
"CARRY ON CHARGES",
"CDGLHR LHRCDG-AF-CARRY ON FEES UNKNOWN-CONTACT CARRIER",
"ADDITIONAL ALLOWANCES AND/OR DISCOUNTS MAY APPLY DEPENDING ON",
"FLYER-SPECIFIC FACTORS /E.G. FREQUENT FLYER STATUS/MILITARY/",
"CREDIT CARD FORM OF PAYMENT/EARLY PURCHASE OVER INTERNET,ETC./"
],
"ValidatingCarrier" : {
"Code" : "AF"
}
}
],
"SolutionInformation" : [
{
"SolutionSequenceNmbr" : "1",
"BaseFareCurrencyCode" : "EUR",
"CurrencyCode" : "EUR",
"GrandTotalEquivFareAmount" : "34.00",
"GrandTotalTaxes" : "91.30",
"RequiresRebook" : "false",
"TicketNumber" : "0",
"TotalAmount" : "125.30"
}
],
"ValidatingCarrier" : [
{
"NewValidatingProcess" : true,
"SolutionSequenceNmbr" : "1",
"SettlementMethod" : "BSP",
"Ticket" : [
{
"Type" : "ETKTREQ",
"CarrierCode" : "AF",
"ValidatingCarrierType" : "Default"
}
]
}
]
},
"PricedItinerary" : {
"AlternativePricing" : "false",
"CurrencyCode" : "EUR",
"MultiTicket" : false,
"TotalAmount" : "125.30",
"AirItineraryPricingInfo" : [
{
"SolutionSequenceNmbr" : "1",
"BaggageProvisions" : [
...
],
"FareCalculation" : {
"Text" : "PAR AF LON17.62AF PAR22.33NUC39.95END ROE0.85086"
},
"FareCalculationBreakdown" : [
{
"Branch" : {
"PCC" : "N1GJ",
"FirstJointCarrier" : "AF"
},
"Departure" : {
"CityCode" : "PAR",
"AirportCode" : "CDG",
"AirlineCode" : "AF",
"GenericInd" : "O",
"ArrivalCityCode" : "LON",
"ArrivalAirportCode" : "LHR"
},
"FareBasis" : {
"Code" : "GS50OALG",
"FareAmount" : "17.62",
"FarePassengerType" : "ADT",
"FareType" : "P",
"FilingCarrier" : "AF",
"GlobalInd" : "EH",
"TripTypeInd" : "R",
"Market" : "PARLON",
"Cabin" : "Y"
},
"FreeBaggageAllowance" : "NONIL",
"RuleCategoryIndicator" : [
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"15",
"16"
]
},
{
"Branch" : {
"PCC" : "N1GJ",
"FirstJointCarrier" : "AF"
},
"Departure" : {
"CityCode" : "LON",
"AirportCode" : "LHR",
"AirlineCode" : "AF",
"GenericInd" : "O",
"ArrivalCityCode" : "PAR",
"ArrivalAirportCode" : "CDG"
},
"FareBasis" : {
"Code" : "XS50OALG",
"FareAmount" : "22.33",
"FarePassengerType" : "ADT",
"FareType" : "P",
"FilingCarrier" : "AF",
"GlobalInd" : "EH",
"TripTypeInd" : "R",
"Market" : "PARLON",
"Cabin" : "Y"
},
"FreeBaggageAllowance" : "NONIL",
"RuleCategoryIndicator" : [
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"15",
"16"
]
}
],
"ItinTotalFare" : {
"NonRefundableInd" : "N",
"BaggageInfo" : {
"NonUS_DOT_Disclosure" : {
"Text" : [
"BAG ALLOWANCE -CDGLHR-NIL/AF",
"1STCHECKED BAG FEE-CDGLHR-EUR45.00/AF/UP TO 50 POUNDS/23 KILOGR",
"AMS AND UP TO 62 LINEAR INCHES/158 LINEAR CENTIMETERS",
"2NDCHECKED BAG FEE-CDGLHR-EUR70.00/AF/UP TO 50 POUNDS/23 KILOGR",
"AMS AND UP TO 62 LINEAR INCHES/158 LINEAR CENTIMETERS",
"BAG ALLOWANCE -LHRCDG-NIL/AF",
"1STCHECKED BAG FEE-LHRCDG-EUR45.00/AF/UP TO 50 POUNDS/23 KILOGR",
"AMS AND UP TO 62 LINEAR INCHES/158 LINEAR CENTIMETERS",
"2NDCHECKED BAG FEE-LHRCDG-EUR70.00/AF/UP TO 50 POUNDS/23 KILOGR",
"AMS AND UP TO 62 LINEAR INCHES/158 LINEAR CENTIMETERS",
"CARRY ON ALLOWANCE",
"CDGLHR LHRCDG-01P/AF",
"01/UP TO 26 POUNDS/12 KILOGRAMS AND UP TO 45 LINEAR INCHES/115",
"LINEAR CENTIMETERS",
"CARRY ON CHARGES",
"CDGLHR LHRCDG-AF-CARRY ON FEES UNKNOWN-CONTACT CARRIER",
"ADDITIONAL ALLOWANCES AND/OR DISCOUNTS MAY APPLY DEPENDING ON",
"FLYER-SPECIFIC FACTORS /E.G. FREQUENT FLYER STATUS/MILITARY/",
"CREDIT CARD FORM OF PAYMENT/EARLY PURCHASE OVER INTERNET,ETC./"
]
}
},
"BaseFare" : {
"Amount" : "34.00",
"CurrencyCode" : "EUR"
},
"Construction" : {
"Amount" : "39.95",
"CurrencyCode" : "NUC",
"RateOfExchange" : "0.850860"
},
"Taxes" : {
"TotalAmount" : "91.30",
"Tax" : [
{
"Amount" : "26.00",
"TaxCode" : "YQI",
"TaxName" : "SERVICE FEE - CARRIER-IMPOSED",
"TicketingTaxCode" : "YQ"
},
{
"Amount" : "16.33",
"TaxCode" : "FR",
"TaxName" : "CIVIL AVIATION TAX DOMESTIC AN",
"TicketingTaxCode" : "FR"
},
{
"Amount" : "13.09",
"TaxCode" : "QX",
"TaxName" : "PASSENGER SERVICE CHARGE INTER",
"TicketingTaxCode" : "QX"
},
{
"Amount" : "1.13",
"TaxCode" : "IZ",
"TaxName" : "AIR PASSENGER SOLIDARITY TAX",
"TicketingTaxCode" : "IZ"
},
{
"Amount" : "14.51",
"TaxCode" : "GB",
"TaxName" : "AIR PASSENGER DUTY APD",
"TicketingTaxCode" : "GB"
},
{
"Amount" : "18.74",
"TaxCode" : "UB",
"TaxName" : "PASSENGER SERVICE CHARGE DEPAR",
"TicketingTaxCode" : "UB"
},
{
"Amount" : "1.50",
"TaxCode" : "O4",
"TaxName" : "AIR PASSENGER SOLIDARITY TAX S",
"TicketingTaxCode" : "O4"
}
]
},
"TotalFare" : {
"Amount" : "125.30",
"CurrencyCode" : "EUR"
}
},
"PassengerTypeQuantity" : {
"Code" : "ADT",
"Quantity" : "1"
},
"PTC_FareBreakdown" : [
{
"Cabin" : "Y",
"FareBasis" : {
"Code" : "GS50OALG",
"FareAmount" : "17.62",
"FarePassengerType" : "ADT",
"FareType" : "P",
"FilingCarrier" : "AF",
"GlobalInd" : "EH",
"Market" : "PARLON"
},
"FreeBaggageAllowance" : "NONIL"
},
{
"Cabin" : "Y",
"FareBasis" : {
"Code" : "XS50OALG",
"FareAmount" : "22.33",
"FarePassengerType" : "ADT",
"FareType" : "P",
"FilingCarrier" : "AF",
"GlobalInd" : "EH",
"Market" : "PARLON"
},
"FreeBaggageAllowance" : "NONIL"
}
]
}
]
}
}
}
],
"TravelItineraryRead" : {
"TravelItinerary" : {
"CustomerInfo" : {
...
},
"ItineraryInfo" : {
"ItineraryPricing" : {
"PriceQuote" : [
{
"RPH" : "1",
"MiscInformation" : {
"SignatureLine" : [
{
"ExpirationDateTime" : "00:00",
"Source" : "SYS",
"Status" : "ACTIVE",
"Text" : "N1GJ N1GJ*AWS 1329/19NOV20"
}
]
},
"PricedItinerary" : [
{
"DisplayOnly" : false,
"InputMessage" : "WPFCK¥S1*ZZGS50OALG¥S2*ZZXS50OALG¥P1ADT¥RQ",
"RPH" : "1",
"StatusCode" : "A",
"TaxExempt" : false,
"ValidatingCarrier" : "AF",
"StoredDateTime" : "2020-11-19T13:29",
"AirItineraryPricingInfo" : {
"ItinTotalFare" : [
{
"BaseFare" : {
"Amount" : "34.00",
"CurrencyCode" : "EUR"
},
"Taxes" : {
"Tax" : {
"Amount" : "91.30",
"TaxCode" : "XT"
},
"TaxBreakdownCode" : [
{
"TaxPaid" : false,
"content" : "26.00YQ"
},
{
"TaxPaid" : false,
"content" : "16.33FR"
},
{
"TaxPaid" : false,
"content" : "13.09QX"
},
{
"TaxPaid" : false,
"content" : "1.13IZ"
},
{
"TaxPaid" : false,
"content" : "14.51GB"
},
{
"TaxPaid" : false,
"content" : "18.74UB"
},
{
"TaxPaid" : false,
"content" : "1.50O4"
}
]
},
"TotalFare" : {
"Amount" : "125.30",
"CurrencyCode" : "EUR"
},
"Totals" : {
"BaseFare" : {
"Amount" : "34.00"
},
"Taxes" : {
"Tax" : {
"Amount" : "91.30"
}
},
"TotalFare" : {
"Amount" : "125.30"
}
}
}
],
"PassengerTypeQuantity" : [
{
"Code" : "ADT",
"Quantity" : "01"
}
],
"PTC_FareBreakdown" : [
{
"Endorsements" : {
"Endorsement" : [
{
"type" : "PRICING_PARAMETER",
"Text" : "WPFCK$S1*ZZGS50OALG$S2*ZZXS50OALG$P1ADT$RQ"
},
{
"type" : "WARNING",
"Text" : "VALIDATING CARRIER - AF"
},
{
"type" : "WARNING",
"Text" : "CAT 15 SALES RESTRICTIONS FREE TEXT FOUND - VERIFY RULES"
}
]
},
"FareBasis" : [
{
"Code" : "GS50OALG/XS50OALG"
}
],
"FareCalculation" : {
"Text" : [
"PAR AF LON17.62AF PAR22.33NUC39.95END ROE0.85086"
]
},
"FareSource" : "ATPC",
"FlightSegment" : [
{
"ConnectionInd" : "O",
"DepartureDateTime" : "02-17T13:15",
"FlightNumber" : "1780",
"ResBookDesigCode" : "G",
"SegmentNumber" : "1",
"Status" : "OK",
"BaggageAllowance" : {
"Number" : "NIL"
},
"FareBasis" : {
"Code" : "GS50OALG"
},
"MarketingAirline" : {
"Code" : "AF",
"FlightNumber" : "1780"
},
"OriginLocation" : {
"LocationCode" : "CDG"
},
"ValidityDates" : {
"NotValidAfter" : "2021-02-17",
"NotValidBefore" : "2021-02-17"
}
},
{
"ConnectionInd" : "O",
"DepartureDateTime" : "02-26T11:30",
"FlightNumber" : "1581",
"ResBookDesigCode" : "X",
"SegmentNumber" : "2",
"Status" : "OK",
"BaggageAllowance" : {
"Number" : "NIL"
},
"FareBasis" : {
"Code" : "XS50OALG"
},
"MarketingAirline" : {
"Code" : "AF",
"FlightNumber" : "1581"
},
"OriginLocation" : {
"LocationCode" : "LHR"
},
"ValidityDates" : {
"NotValidAfter" : "2021-02-26",
"NotValidBefore" : "2021-02-26"
}
},
{
"OriginLocation" : {
"LocationCode" : "CDG"
}
}
],
"FareComponent" : [
{
"FareBasisCode" : "GS50OALG",
"FareDirectionality" : "FROM",
"Amount" : "1762",
"TicketDesignator" : "",
"GoverningCarrier" : "AF",
"FareComponentNumber" : "1",
"Location" : {
"Origin" : "PAR",
"Destination" : "LON"
},
"Dates" : {
"DepartureDateTime" : "02-17T13:15",
"ArrivalDateTime" : "02-17T13:45"
},
"FlightSegmentNumbers" : {
"FlightSegmentNumber" : [
"1"
]
}
},
{
"FareBasisCode" : "XS50OALG",
"FareDirectionality" : "TO",
"Amount" : "2233",
"TicketDesignator" : "",
"GoverningCarrier" : "AF",
"FareComponentNumber" : "2",
"Location" : {
"Origin" : "LON",
"Destination" : "PAR"
},
"Dates" : {
"DepartureDateTime" : "02-26T11:30",
"ArrivalDateTime" : "02-26T13:50"
},
"FlightSegmentNumbers" : {
"FlightSegmentNumber" : [
"2"
]
}
}
]
}
]
}
}
],
"ResponseHeader" : {
"Text" : [
"FARE - PRICE RETAINED",
"FARE USED TO CALCULATE DISCOUNT",
"FARE NOT GUARANTEED UNTIL TICKETED"
]
},
"PriceQuotePlus" : {
"DomesticIntlInd" : "I",
"PricingStatus" : "S",
"VerifyFareCalc" : false,
"ItineraryChanged" : false,
"ManualFare" : false,
"NegotiatedFare" : false,
"SystemIndicator" : "S",
"NUCSuppresion" : false,
"SubjToGovtApproval" : false,
"IT_BT_Fare" : "BT",
"DisplayOnly" : false,
"DiscountAmount" : "0",
"PassengerInfo" : {
"PassengerType" : "ADT",
"PassengerData" : [
{
"NameNumber" : "01.01",
"content" : "TEST/TEST"
}
]
},
"TicketingInstructionsInfo" : {}
}
}
],
"PriceQuoteTotals" : {
"BaseFare" : {
"Amount" : "34.00"
},
"Taxes" : {
"Tax" : {
"Amount" : "91.30"
}
},
"TotalFare" : {
"Amount" : "125.30"
}
}
},
"Ticketing" : [
{
"RPH" : "01",
"TicketTimeLimit" : "TAWL4GJ19NOV009/"
}
]
},
"ItineraryRef" : {
...
},
"SpecialServiceInfo" : [
{
"RPH" : "001",
"Type" : "GFX",
"Id" : "14",
"Service" : {
"SSR_Code" : "SSR",
"SSR_Type" : "DOCS",
"Airline" : {
"Code" : "AF"
},
"PersonName" : [
{
"NameNumber" : "01.01",
"content" : "TEST/TEST"
}
],
"Text" : [
"HK1/DB/13JAN1991/M/TEST/TEST"
]
}
},
{
"RPH" : "002",
"Type" : "GFX",
"Id" : "15",
"Service" : {
"SSR_Code" : "SSR",
"SSR_Type" : "CTCM",
"Airline" : {
"Code" : "AF"
},
"PersonName" : [
{
"NameNumber" : "01.01",
"content" : "TEST/TEST"
}
],
"Text" : [
"HK1/0033142890939"
]
}
},
{
"RPH" : "003",
"Type" : "GFX",
"Id" : "16",
"Service" : {
"SSR_Code" : "SSR",
"SSR_Type" : "CTCE",
"Airline" : {
"Code" : "AF"
},
"PersonName" : [
{
"NameNumber" : "01.01",
"content" : "TEST/TEST"
}
],
"Text" : [
"TEST"
]
}
}
]
}
}
}
Do I need to specify something in CreatePassengerNameRecordRQ to freeze the fare quote ?
Is there any other action needed to access this special option offered by some airlines ?
Thank you !

Related

How do i change MongoDB JSON data to array

I need to update the MongoDB field with the array of objects where JSON object to be updated with as an array
if I have something like this in MongoDB
"designSectionContents" : [
{
"_id" : "5bae17ecbd7595540145ec98",
"type" : "subSection",
"columns" : [
{
"0" : {
"itemId" : "5b7465980783d9a37058f160",
"type" : "field"
}
},
{
"0" : {
"itemId" : "5b7465630783d9a37058f15c",
"type" : "field"
}
},
{
"0" : {
"itemId" : "5b7465810783d9a37058f15e",
"type" : "field"
}
}
],
"subSectionContentLayout" : {
"labelPlacement" : "Top",
"columns" : 3
}
}
]
I want to change the above snippet to below in MongoDB
"designSectionContents" : [
{
"_id" : ObjectId("5bae17ecbd7595540145ec98"),
"type" : "subSection",
"columns" : [
[
{
"itemId" : "5b7465980783d9a37058f160",
"type" : "field"
}
],
[
{
"itemId" : "5b7465630783d9a37058f15c",
"type" : "field"
}
],
[
{
"itemId" : "5b7465810783d9a37058f15e",
"type" : "field"
}
]
]
}
]
curly braces opening and closing tag has to be changed to array
This should work:
db.collection.aggregate([
{
"$project": {
"designSectionContents": {
"$map": {
"input": "$designSectionContents",
"as": "designSectionContent",
"in": {
"_id": "$$designSectionContent._id",
"type": "$$designSectionContent.type",
"columns": {
"$map": {
"input": "$$designSectionContent.columns",
"as": "inp",
"in": [
"$$inp.0"
]
}
}
}
}
}
}
}
]);
Here's the working link.

mapper_parsing_exception in Elasticsearch(Reason: No type specified for field [X])

I wanted to provide explicit mapping to the fields in my document, So I defined a mapping for my index demo and It looks like this below:
PUT /demo
{
"mappings": {
"properties": {
"X" : {
"X" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"Sub_X" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
}
}
After running the query , I am getting error as :
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "No type specified for field [X]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Failed to parse mapping [_doc]: No type specified for field [X]",
"caused_by" : {
"type" : "mapper_parsing_exception",
"reason" : "No type specified for field [X]"
}
},
"status" : 400
}
The field X in json document looks like :
"X" : {
"X" : [
"a"
],
"Sub_X" : [
[
"b"
]
]
},
Please help me out with this elastic search mapper_parse_exception error.
What you have is called nested data type
You have X which in turn contains X and Sub_X.
Mapping:
{
"properties": {
"X": {
"type": "nested"
}
}
}
Data:
{
"X": {
"X": [
"a"
],
"Sub_X": [
[
"b"
]
]
}
}
Query:
{
"query": {
"nested": {
"path": "X",
"query": {
"bool": {
"must": [
{ "match": { "X.X": "a" }},
{ "match": { "X.Sub_X": "b" }}
]
}
}
}
}
}
It outputs the document.

Sparql Group Entire Objects into List

I have a list of restaurants and want to return them grouped in lists by two identifiers. The response would look this this in JSON:
[
{
"restaurantChainId": "1",
"restaurantTypeId": "001",
"restaurantList": [
{
"restaurantId": "1-1",
"restaurantChainId": "1",
"restaurantTypeId": "001",
"restaurant name": "Pizza Place London"
"restaurant location": "London"
},
{
"restaurantId": "1-2",
"restaurantChainId": "1",
"restaurantTypeId": "001",
"restaurant name": "Pizza Place Birmingham"
"restaurant location": "Birmingham"
}
]
},
{
"restaurantChainId": "1",
"restaurantTypeId": "002",
"restaurantList": [
{
"restaurantId": "1-3",
"restaurantChainId": "1",
"restaurantTypeId": "002",
"restaurant name": "Pizza Place Manchester"
"restaurant location": "Manchester"
}
]
},
{
"restaurantChainId": "2",
"restaurantTypeId": "002",
"restaurantList": [
{
"restaurantId": "2-1",
"restaurantChainId": "2",
"restaurantTypeId": "002",
"restaurant name": "Taco Town London"
"restaurant location": "London"
},
{
"restaurantId": "2-2",
"restaurantChainId": "2",
"restaurantTypeId": "002",
"restaurant name": "Taco Town Newcastle"
"restaurant location": "Newcastle"
}
]
}
]
So that an object in the array has a list where each in the list shares the restaurantChainId and the restaurantTypeId.
I have tried the following group_concat query:
SELECT ?restaurantChainId (GROUP_CONCAT(?restaurantTypeId; SEPARATOR=", ") AS ?restaurantTypeIdList)
WHERE {
?restaurant <http://example.com/terms#docType> "restaurant" ;
<http://example.com/terms#restaurantTypeId> ?restaurantTypeId;
<http://example.com/terms#institutionFid> ?restaurantChainId .
FILTER (strstarts(str(?restaurantTypeId), '00'))
} GROUP BY ?restaurantChainId
But obviously this is just producing a list restaurantTypeId for each restaurantChainId. So it has grouped things correctly. I have things in the correct groups but I only have the id list for each restaurant where I actually want all related information of that restaurant. I don't really know how to go about this. Is it possible?
Improved Query
SELECT ?restaurantChainId (GROUP_CONCAT(DISTINCT ?restaurantTypeId; SEPARATOR=", ") AS ?restaurantTypeIdList) (GROUP_CONCAT(?restaurant; SEPARATOR=", ") AS ?restaurant)
WHERE {
?restaurant <http://example.co.uk/terms#docType> "restaurant" ;
<http://example.co.uk/terms#swiftbic> ?restaurantTypeId;
<http://example.co.uk/terms#institutionFid> ?restaurantChainId ;
<http://example.co.uk/terms#fid> ?officeId .
FILTER (strstarts(str(?restaurantTypeId), 'ABA'))
} GROUP BY ?restaurantChainId ?restaurantTypeId
And here is the current result:
{
"head" : {
"vars" : [ "restaurantChainId", "restaurantTypeIdList", "restaurant" ]
},
"results" : {
"bindings" : [ {
"restaurantChainId" : {
"type" : "literal",
"value" : "XYZ"
},
"restaurantTypeIdList" : {
"type" : "literal",
"value" : "ABA3"
},
"restaurant" : {
"type" : "literal",
"value" : "http://example.co.uk/restaurant/XYZ-4, http://example.co.uk/restaurant/XYZ-5, http://example.co.uk/restaurant/XYZ-6"
}
}, {
"restaurantChainId" : {
"type" : "literal",
"value" : "ABC"
},
"restaurantTypeIdList" : {
"type" : "literal",
"value" : "ABA1"
},
"restaurant" : {
"type" : "literal",
"value" : "http://example.co.uk/restaurant/ABC-14, http://example.co.uk/restaurant/ABC-15, http://example.co.uk/restaurant/ABC-4"
}
}, {
"restaurantChainId" : {
"type" : "literal",
"value" : "XYZ"
},
"restaurantTypeIdList" : {
"type" : "literal",
"value" : "ABA1"
},
"restaurant" : {
"type" : "literal",
"value" : "http://example.co.uk/restaurant/XYZ-2, http://example.co.uk/restaurant/XYZ-1"
}
}, {
"restaurantChainId" : {
"type" : "literal",
"value" : "XYZ"
},
"restaurantTypeIdList" : {
"type" : "literal",
"value" : "ABA2"
},
"restaurant" : {
"type" : "literal",
"value" : "http://example.co.uk/restaurant/XYZ-3"
}
}, {
"restaurantChainId" : {
"type" : "literal",
"value" : "ABC"
},
"restaurantTypeIdList" : {
"type" : "literal",
"value" : "ABA2"
},
"restaurant" : {
"type" : "literal",
"value" : "http://example.co.uk/restaurant/ABC-9"
}
} ]
}
}
So the actually groupings are correct and I have the uri for each restaurant but I don't know how to get information specifically related to them.

How to access the all key value?

All "long_name" value for all index of "address_Components" is not display. When using the path: path("results[0].address_components[].long_name")
then test case is failed.
I want to display all "long_name" value given in response. Please suggest me.
{
"results" : [
{
"address_components" : [
{
"long_name" : "Chicago",
"short_name" : "Chicago",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Cook County",
"short_name" : "Cook County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Illinois",
"short_name" : "IL",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Chicago, IL, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 42.023131,
"lng" : -87.52366099999999
},
"southwest" : {
"lat" : 41.6443349,
"lng" : -87.9402669
}
},
"location" : {
"lat" : 41.8781136,
"lng" : -87.6297982
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 42.023131,
"lng" : -87.52404399999999
},
"southwest" : {
"lat" : 41.6443349,
"lng" : -87.9402669
}
}
},
"place_id" : "ChIJ7cv00DwsDogRAMDACa2m4K8",
"types" : [ "locality", "political" ]
}
],
"status" : "OK"
}
I am using selenium (Maven TestNG):
#Test
public void test_08(){
String[] arrayList = {"chicago"};
for(int i=0; i<arrayList.length; i++){
Response resp = given().
parameter("address", arrayList[i]).
when().
get("http://maps.googleapis.com/maps/api/geocode/json");
Assert.assertEquals(resp.getStatusCode(), 200);
String respReport = resp.
then().
contentType(ContentType.JSON).
extract().
path("results[0].address_components[0].long_name");
System.out.println("Logn Name: "+respReport+);
}
}
OUT PUT:
Logn Name: Chicago
PASSED: test_08
It is because you don't give an index to components as well which is also a json array! So this one passes because you are giving an index to components:
path("results[0].address_components[0].long_name");
Whilst in your bold text at the top of your description you don't.
Now for iterating through the various elements of address_componenents array all you need to do is find the length of the address_components array and then increase the index from zero until < length.of the json array. Something like this:
String jsonObjectAsString = jsonObjectFromYourResponse.toString();
public void retrieveAddressComponenets(String jsonObjectAsString){
JsonElement jelement = new JsonParser().parse(jsonObjectAsString);
JsonObject jobject = jelement.getAsJsonObject();
JsonArray jArray = jobject.getAsJsonArray("address_components");
int i=0;
while(i<jArray.length()){
jelement = new JsonParser().parse(jarray.get(i).toString());
System.out.println("Logn Name: "+respReport);
i++;
}
}
Here is how your json object looks like (currently it has 4 entries you want to retrieve)
Hope this helps to resolve!
Best of luck!

How does MongoDB index arrays?

In MongoDB, if I were to store an array (say ["red", "blue"]) in a field "color", does it index "red" and "blue" so I could query for "red", for example, or does in make {"red", "blue"} a composite index?
When it comes to indexing arrays, MongoDB indexes each value of the array so you can query for individual items, such as "red." For example:
> db.col1.save({'colors': ['red','blue']})
> db.col1.ensureIndex({'colors':1})
> db.col1.find({'colors': 'red'})
{ "_id" : ObjectId("4ccc78f97cf9bdc2a2e54ee9"), "colors" : [ "red", "blue" ] }
> db.col1.find({'colors': 'blue'})
{ "_id" : ObjectId("4ccc78f97cf9bdc2a2e54ee9"), "colors" : [ "red", "blue" ] }
For more information, check out MongoDB's documentation on Multikeys: http://www.mongodb.org/display/DOCS/Multikeys
You can simply test index usage by appending "explain" to your query:
> db.col1.save({'colors': ['red','blue']})
# without index
> db.col1.find({'colors': 'red'}).explain()
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "protrain.col1",
"indexFilterSet" : false,
"parsedQuery" : {
"colors" : {
"$eq" : "red"
}
},
"winningPlan" : {
"stage" : "COLLSCAN", <--- simple column scan
"filter" : {
"colors" : {
"$eq" : "red"
}
},
"direction" : "forward"
},
"rejectedPlans" : [ ]
},
"serverInfo" : {
"host" : "bee34f15fe28",
"port" : 27017,
"version" : "3.4.4",
"gitVersion" : "888390515874a9debd1b6c5d36559ca86b44babd"
},
"ok" : 1
}
# query with index
> db.col1.createIndex( { "colors":1 } )
> db.col1.find({'colors': 'red'}).explain()
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "protrain.col1",
"indexFilterSet" : false,
"parsedQuery" : {
"colors" : {
"$eq" : "red"
}
},
"winningPlan" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN", <!---- INDEX HAS BEEN USED
"keyPattern" : {
"colors" : 1
},
"indexName" : "colors_1",
"isMultiKey" : true,
"multiKeyPaths" : {
"colors" : [
"colors"
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"colors" : [
"[\"red\", \"red\"]"
]
}
}
},
"rejectedPlans" : [ ]
},
"serverInfo" : {
"host" : "bee34f15fe28",
"port" : 27017,
"version" : "3.4.4",
"gitVersion" : "888390515874a9debd1b6c5d36559ca86b44babd"
},
"ok" : 1
}
For structures where you have structured indexes, you could use the array position to index fields inside arrays:
{
'_id': 'BB167E2D61909E848EBC96C7B33251AC',
'hist': {
'map': {
'10': 1
}
},
'wayPoints': [{
'bhf_name': 'Zinsgutstr.(Berlin)',
'ext_no': 900180542,
'lat': 52.435158,
'lon': 13.559086,
'puic': 86,
'time': {
'dateTime': '2018-01-10T09: 38: 00',
'offset': {
'totalSeconds': 3600
}
},
'train_name': 'Bus162'
},
{
'bhf_name': 'SAdlershof(Berlin)',
'ext_no': 900193002,
'lat': 52.435104,
'lon': 13.54055,
'puic': 86,
'time': {
'dateTime': '2018-01-10T09: 44: 00',
'offset': {
'totalSeconds': 3600
}
},
'train_name': 'Bus162'
}]
}
db.col.createIndex( { "wayPoints.0.ext_no":1 } )
db.col.createIndex( { "wayPoints.0.train_name":1 } )
db.col.createIndex( { "wayPoints.1.ext_no":1 } )
db.col.createIndex( { "wayPoints.1.train_name":1 } )
> db.col.find(
... {
... "wayPoints.ext_no": 900180542
... }
... ,
... {
... "wayPoints.ext_no":1,
... "wayPoints.train_name":1,
... "wayPoints.time":1
... }
... ).explain()
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "db.col",
"indexFilterSet" : false,
"parsedQuery" : {
"wayPoints.ext_no" : {
"$eq" : 900180542
}
},
"winningPlan" : {
"stage" : "PROJECTION",
"transformBy" : {
"wayPoints.ext_no" : 1,
"wayPoints.train_name" : 1,
"wayPoints.time" : 1
},
"inputStage" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"wayPoints.ext_no" : 1
},
"indexName" : "wayPoints.ext_no_1",
"isMultiKey" : true,
"multiKeyPaths" : {
"wayPoints.ext_no" : [
"wayPoints"
]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"wayPoints.ext_no" : [
"[900180542.0, 900180542.0]"
]
}
}
}
},
"rejectedPlans" : [ ]
},
"serverInfo" : {
"host" : "bee34f15fe28",
"port" : 27017,
"version" : "3.4.4",
"gitVersion" : "888390515874a9debd1b6c5d36559ca86b44babd"
},
"ok" : 1
}