Creating A Reservation Using the amelia APIs
This article will outline the best practices around creating a booking using the amelia APIs.
Ā
Table of contents |
---|
Step 1: Get Travel Options
There are several ways to get travel options using the amelia APIs. The recommended approach and the approach that will be outlined in this article is using RESTv1 GET Travel Options.
There are many parameters for the travel options request in RESTv1. Here is a detailed list of these parameters as well as their description and type:
Name | Description | Type | Additional Info |
---|---|---|---|
cityPair | The origin and destination airport city pair. | string | Required |
departure | The date of departure. | string | Required |
cabinClass | The cabin class code being requested. Also known as class of service or level of service. | string | Required |
currency | The currency code for the currency amounts returned. | string | Required |
adultCount | The number of adult passengers expected to reserve. 0 or above. | integer | Required |
childCount | The number of child passengers expected to reserve. 0 or above. | integer | Required |
infantCount | The number of infant passengers expected to reserve. 0 or above. | integer | Required |
daysBeforeDeparture | Optional number of days to include prior to chosen date of departure. | integer | Default value is 0 |
daysAfterDeparture | Optional number of days to include following the chosen date of departure. | integer | Default value is 0 |
earliestDeparture | Optional earliest date of departure. An alternative to daysBeforeDeparture. | string | Default value is blank |
latestDeparture | Optional latest date of departure. An alternative to daysAfterDeparture. | string | Default value is blank |
return | Optional date of return. | string | Default value is blank |
daysBeforeReturn | Optional number of days to include prior to chosen date of return. | integer | Default value is 0 |
daysAfterReturn | Optional number of days to include following the chosen date of return. | integer | Default value is 0 |
earliestReturn | Optional earliest date of return. An alternative to daysBeforeReturn. | string | Default value is blank |
latestReturn | Optional latest date of return. An alternative to daysAfterReturn. | string | Default value is blank |
promoCode | Optional promotion code to be validated and applied during fare retrieval. | string | Default value is blank |
company | Optional company key to be validated and applied during fare retrieval. Ignored if not authorized. | string | Default value is blank |
To create the authorization header for this request you will need to be setup with valid amelia credentials. You will need to Base64 encode these credentials in order to pass them in the auth header. Depending on the tool you're using this may be something that can be done for you. Here's an example of encoding username:intelisys1 and password:pass123:
The following would get passed to whichever encoding tool you choose to use:
intelisys1:pass123
The ouput would look something like this:
aW50ZWxpc3lzMTpwYXNzMTIz
Once you have the credentials encoded, it can be passed in the auth header as follows:
Authorization: Basic aW50ZWxpc3lzMTpwYXNzMTIz
For the duration of this article I will be using https://InteliSys-api.intelisys.ca/RESTv1/InteliSys as the endpoint for demonstrative purposes.
This example will return travel options from Moncton (YQM) to Montreal (YUL) on November 10th for one adult. To get the travel options for this the URL would look as follows:
https://InteliSys-api.intelisys.ca/RESTv1/InteliSys/travelOptions?cityPair=YQM-YUL&departure=2016-11-10&cabinClass=J¤cy=USD&adultCount=1&childCount=0&infantCount=0&daysBeforeDeparture=7&daysAfterDeparture=7
In the response of this request will be many travel options that fit the criteria supplied.
Step 2: Populate the Booking Request
The booking request can get very complicated. To start off, we'll begin with the basic structure populated with the fare and flight information returned via travel options. In the sample below, the portion of travel options that each value got pulled from is outlined beside the appropriate portion of the booking xml.
<int:Query> <int1:Legs> <int1:BookingLeg> <int1:AdultFares> <int1:BookingClassCode>Y</int1:BookingClassCode> <---- bookingCode:code <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:FareCode>Y</int1:FareCode> <---- fareClass:code <int1:PaxCount>1</int1:PaxCount> <int1:TotalCost>179</int1:TotalCost> <---- fareCharges:currencyAmounts:totalAmount </int1:AdultFares> <int1:Segments> <int1:BookingSegment> <int1:ArrivalAirportCode>YUL</int1:ArrivalAirportCode> <---- flights:arrival:airport:code <int1:DepartureAirportCode>YQM</int1:DepartureAirportCode> <---- flights:departure:airport:code <int1:ETALocal>2016-11-09T18:35:00</int1:ETALocal> <---- flights:arrival:scheduledTime (adjusted to local using utc offset) <int1:ETDLocal>2016-11-09T17:15:00</int1:ETDLocal> <---- flights:departure:scheduledTime (adjusted to local using utc offset) <int1:FlightCode>WJ8316</int1:FlightCode> <---- flights:airlineCode + flights:flightNumber </int1:BookingSegment> </int1:Segments> </int1:BookingLeg> </int1:Legs> <int1:Passengers> <int1:BookingPassenger> <int1:AgeCategory>Adult</int1:AgeCategory> <int1:DateOfBirth>1989-12-12</int1:DateOfBirth> <int1:DestinationTelephone>1234567891</int1:DestinationTelephone> <int1:Firstname>John</int1:Firstname> <int1:Gender>Male</int1:Gender> <int1:Lastname>Doe</int1:Lastname> <int1:Middlename>M</int1:Middlename> <int1:Title>Mr</int1:Title> </int1:BookingPassenger> </int1:Passengers> <int1:Payment> <int1:Amount>192.88</int1:Amount> <---- the fare amount + applicable surcharges <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:PaymentType>Hold</int1:PaymentType> <int1:ProcessingFee>0</int1:ProcessingFee> <int1:ProcessingFeeTax>0</int1:ProcessingFeeTax> </int1:Payment> </int:Query>
<int:Query> <int1:Legs> <int1:BookingLeg> <int1:AdultFares> <int1:BookingClassCode>Y</int1:BookingClassCode> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:FareCode>Y</int1:FareCode> <int1:PaxCount>1</int1:PaxCount> <int1:TotalCost>179</int1:TotalCost> </int1:AdultFares> <int1:Segments> <int1:BookingSegment> <int1:ArrivalAirportCode>YUL</int1:ArrivalAirportCode> <int1:DepartureAirportCode>YQM</int1:DepartureAirportCode> <int1:ETALocal>2016-11-09T18:35:00</int1:ETALocal> <int1:ETDLocal>2016-11-09T17:15:00</int1:ETDLocal> <int1:FlightCode>WJ8316</int1:FlightCode> </int1:BookingSegment> </int1:Segments> </int1:BookingLeg> </int1:Legs> <int1:Passengers> <int1:BookingPassenger> <int1:AgeCategory>Adult</int1:AgeCategory> <int1:DateOfBirth>1989-12-12</int1:DateOfBirth> <int1:DestinationTelephone>1234567891</int1:DestinationTelephone> <int1:Firstname>John</int1:Firstname> <int1:Gender>Male</int1:Gender> <int1:Lastname>Doe</int1:Lastname> <int1:Middlename>M</int1:Middlename> <int1:Title>Mr</int1:Title> </int1:BookingPassenger> </int1:Passengers> <int1:Payment> <int1:Amount>192.88</int1:Amount> <int1:CreditCardPayment> <int1:Address> <int1:Addr1>123 anywhere st</int1:Addr1> <int1:Addr2>apt 12</int1:Addr2> <int1:City>saint john</int1:City> <int1:CountryCode>CDN</int1:CountryCode> <int1:CountryDescription>Canada</int1:CountryDescription> <int1:PostalCode>e2e2e2</int1:PostalCode> <int1:ProvinceAbbreviation>nb</int1:ProvinceAbbreviation> <int1:ProvinceName>new brunswick</int1:ProvinceName> </int1:Address> <int1:CVV>377</int1:CVV> <int1:Email>email@email.com</int1:Email> <int1:ExpireYear>2017</int1:ExpireYear> <int1:ExpiryMonth>12</int1:ExpiryMonth> <int1:Firstname>John</int1:Firstname> <int1:Lastname>Doe</int1:Lastname> <int1:Number>4111111111111111</int1:Number> <int1:TypeCode>VI</int1:TypeCode> </int1:CreditCardPayment> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:PaymentType>Hold</int1:PaymentType> <int1:ProcessingFee>0</int1:ProcessingFee> <int1:ProcessingFeeTax>0</int1:ProcessingFeeTax> </int1:Payment> </int:Query>
<tem:CalculateProcessingFee> <tem:request> <int:Query> <int1:Legs> <int1:BookingLeg> <int1:AdultFares> <int1:BookingClassCode>Y</int1:BookingClassCode> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:FareCode>Y</int1:FareCode> <int1:PaxCount>1</int1:PaxCount> <int1:TotalCost>179</int1:TotalCost> </int1:AdultFares> <int1:Segments> <int1:BookingSegment> <int1:ArrivalAirportCode>YUL</int1:ArrivalAirportCode> <int1:DepartureAirportCode>YQM</int1:DepartureAirportCode> <int1:ETALocal>2016-11-09T18:35:00</int1:ETALocal> <int1:ETDLocal>2016-11-09T17:15:00</int1:ETDLocal> <int1:FlightCode>WJ8316</int1:FlightCode> </int1:BookingSegment> </int1:Segments> </int1:BookingLeg> </int1:Legs> <int1:Passengers> <int1:BookingPassenger> <int1:AgeCategory>Adult</int1:AgeCategory> <int1:DateOfBirth>1989-12-12</int1:DateOfBirth> <int1:DestinationTelephone>1234567891</int1:DestinationTelephone> <int1:Firstname>John</int1:Firstname> <int1:Gender>Male</int1:Gender> <int1:Lastname>Doe</int1:Lastname> <int1:Middlename>M</int1:Middlename> <int1:Title>Mr</int1:Title> </int1:BookingPassenger> </int1:Passengers> <int1:Payment> <int1:Amount>192.88</int1:Amount> <int1:CreditCardPayment> <int1:Address> <int1:Addr1>123 anywhere st</int1:Addr1> <int1:Addr2>apt 12</int1:Addr2> <int1:City>saint john</int1:City> <int1:CountryCode>CDN</int1:CountryCode> <int1:CountryDescription>Canada</int1:CountryDescription> <int1:PostalCode>e2e2e2</int1:PostalCode> <int1:ProvinceAbbreviation>nb</int1:ProvinceAbbreviation> <int1:ProvinceName>new brunswick</int1:ProvinceName> </int1:Address> <int1:CVV>377</int1:CVV> <int1:Email>email@email.com</int1:Email> <int1:ExpireYear>2017</int1:ExpireYear> <int1:ExpiryMonth>12</int1:ExpiryMonth> <int1:Firstname>John</int1:Firstname> <int1:Lastname>Doe</int1:Lastname> <int1:Number>4111111111111111</int1:Number> <int1:TypeCode>VI</int1:TypeCode> </int1:CreditCardPayment> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:PaymentType>CreditCard</int1:PaymentType> <int1:ProcessingFee>0</int1:ProcessingFee> <int1:ProcessingFeeTax>0</int1:ProcessingFeeTax> </int1:Payment> </int:Query> </tem:request> </tem:CalculateProcessingFee>
<CalculateProcessingFeeResult xmlns:a="http://schemas.datacontract.org/2004/07/InteliSys.Amelia.API" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:AuditKey>28d514eb-7196-4a10-ab4b-757e364b3194</a:AuditKey> <a:OperationMessage>OK</a:OperationMessage> <a:OperationSucceeded>true</a:OperationSucceeded> <a:OperationUID>28d514eb-7196-4a10-ab4b-757e364b3194</a:OperationUID> <a:Query xmlns:b="http://schemas.datacontract.org/2004/07/InteliSys.Amelia"> <b:Company i:nil="true"/> <b:Legs> <b:BookingLeg> <b:AdultFares> <b:BookingClassCode>Y</b:BookingClassCode> <b:CurrencyCode>USD</b:CurrencyCode> <b:FareCode>Y</b:FareCode> <b:PaxCount>1</b:PaxCount> <b:TotalCost>179</b:TotalCost> </b:AdultFares> <b:ChildFares i:nil="true"/> <b:PromoCodeID>0</b:PromoCodeID> <b:PromoCodeSuffixID>0</b:PromoCodeSuffixID> <b:Segments> <b:BookingSegment> <b:ArrivalAirportCode>YUL</b:ArrivalAirportCode> <b:DepartureAirportCode>YQM</b:DepartureAirportCode> <b:ETALocal>2016-11-09T18:35:00</b:ETALocal> <b:ETDLocal>2016-11-09T17:15:00</b:ETDLocal> <b:FlightCode>WJ8316</b:FlightCode> </b:BookingSegment> </b:Segments> </b:BookingLeg> </b:Legs> <b:Passengers> <b:BookingPassenger> <b:Address i:nil="true"/> <b:AgeCategory>Adult</b:AgeCategory> <b:AirportSSRs i:nil="true"/> <b:BusinessContact i:nil="true"/> <b:CityPairSSRs i:nil="true"/> <b:DateOfBirth>1989-12-12T00:00:00</b:DateOfBirth> <b:DestinationTelephone>1234567891</b:DestinationTelephone> <b:Firstname>John</b:Firstname> <b:FlightSSRs i:nil="true"/> <b:Gender>Male</b:Gender> <b:General1 i:nil="true"/> <b:General2 i:nil="true"/> <b:Infants i:nil="true"/> <b:Lastname>Doe</b:Lastname> <b:Loyalty i:nil="true"/> <b:LoyaltyId i:nil="true"/> <b:Middlename>M</b:Middlename> <b:Passport i:nil="true"/> <b:PersonalContact i:nil="true"/> <b:ProfilePassword i:nil="true"/> <b:ProfileUsername i:nil="true"/> <b:SpecialNeeds i:nil="true"/> <b:Title>Mr</b:Title> </b:BookingPassenger> </b:Passengers> <b:Payment> <b:AccountPayment i:nil="true"/> <b:Amount>192.88</b:Amount> <b:CreditCardPayment> <b:Address> <b:Addr1>123 anywhere st</b:Addr1> <b:Addr2>apt 12</b:Addr2> <b:City>saint john</b:City> <b:CountryCode>CDN</b:CountryCode> <b:CountryDescription>Canada</b:CountryDescription> <b:PostalCode>e2e2e2</b:PostalCode> <b:ProvinceAbbreviation>nb</b:ProvinceAbbreviation> <b:ProvinceName>new brunswick</b:ProvinceName> </b:Address> <b:CVV>377</b:CVV> <b:Email>email@email.com</b:Email> <b:ExpireYear>2017</b:ExpireYear> <b:ExpiryMonth>12</b:ExpiryMonth> <b:Firstname>John</b:Firstname> <b:Lastname>Doe</b:Lastname> <b:Number>4111111111111111</b:Number> <b:TypeCode>VI</b:TypeCode> </b:CreditCardPayment> <b:CurrencyCode>USD</b:CurrencyCode> <b:PaymentType>CreditCard</b:PaymentType> <b:ProcessingFee>10.00</b:ProcessingFee> <b:ProcessingFeeTax>1.15</b:ProcessingFeeTax> <b:RedeemVoucher i:nil="true"/> <b:ThirdPartyPayment i:nil="true"/> </b:Payment> </a:Query> </CalculateProcessingFeeResult>
<int:Query> <int1:Legs> <int1:BookingLeg> <int1:AdultFares> <int1:BookingClassCode>Y</int1:BookingClassCode> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:FareCode>Y</int1:FareCode> <int1:PaxCount>1</int1:PaxCount> <int1:TotalCost>179</int1:TotalCost> </int1:AdultFares> <int1:Segments> <int1:BookingSegment> <int1:ArrivalAirportCode>YUL</int1:ArrivalAirportCode> <int1:DepartureAirportCode>YQM</int1:DepartureAirportCode> <int1:ETALocal>2016-11-09T18:35:00</int1:ETALocal> <int1:ETDLocal>2016-11-09T17:15:00</int1:ETDLocal> <int1:FlightCode>WJ8316</int1:FlightCode> </int1:BookingSegment> </int1:Segments> </int1:BookingLeg> </int1:Legs> <int1:Passengers> <int1:BookingPassenger> <int1:AgeCategory>Adult</int1:AgeCategory> <int1:DateOfBirth>1989-12-12</int1:DateOfBirth> <int1:DestinationTelephone>1234567891</int1:DestinationTelephone> <int1:Firstname>John</int1:Firstname> <int1:Gender>Male</int1:Gender> <int1:Lastname>Doe</int1:Lastname> <int1:Middlename>M</int1:Middlename> <int1:Title>Mr</int1:Title> </int1:BookingPassenger> </int1:Passengers> <int1:Payment> <int1:Amount>192.88</int1:Amount> <int1:CreditCardPayment> <int1:Address> <int1:Addr1>123 anywhere st</int1:Addr1> <int1:Addr2>apt 12</int1:Addr2> <int1:City>saint john</int1:City> <int1:CountryCode>CDN</int1:CountryCode> <int1:CountryDescription>Canada</int1:CountryDescription> <int1:PostalCode>e2e2e2</int1:PostalCode> <int1:ProvinceAbbreviation>nb</int1:ProvinceAbbreviation> <int1:ProvinceName>new brunswick</int1:ProvinceName> </int1:Address> <int1:CVV>377</int1:CVV> <int1:Email>email@email.com</int1:Email> <int1:ExpireYear>2017</int1:ExpireYear> <int1:ExpiryMonth>12</int1:ExpiryMonth> <int1:Firstname>John</int1:Firstname> <int1:Lastname>Doe</int1:Lastname> <int1:Number>4111111111111111</int1:Number> <int1:TypeCode>VI</int1:TypeCode> </int1:CreditCardPayment> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:PaymentType>CreditCard</int1:PaymentType> <int1:ProcessingFee>10</int1:ProcessingFee> <int1:ProcessingFeeTax>1.15</int1:ProcessingFeeTax> </int1:Payment> </int:Query>
Step 3: Adding Ancillary Items (Optional)
Next we'll add an ancillary item. First get a list of available ancillaries for the city pair chosen. The best was to do this is using the GetCityPairSSRAllocations request under the Booking Service in APIv3. Here is a sample of that request:
<tem:GetCityPairSSRAllocations> <tem:allocRequest> <int:ArrivalAirportCode>YUL</int:ArrivalAirportCode> <int:CurrencyCode>USD</int:CurrencyCode> <int:DepartureAirportCode>YQM</int:DepartureAirportCode> <int:ETALocal>2016-11-09T18:35:00</int:ETALocal> <int:ETDLocal>2016-11-09T17:15:00</int:ETDLocal> </tem:allocRequest> </tem:GetCityPairSSRAllocations>
The response will contain a list of city pair items that are currently set up for the city pair chosen. Here is a snippet of the response:
<b:CategoryOfCityPairAllocations> <b:Allocations> <b:CityPairItem> <b:ChargeAmount>50</b:ChargeAmount> <b:Description>Testing_Steak</b:Description> <b:ID>1167</b:ID> <b:IsMandatory>true</b:IsMandatory> <b:MaxQuatityPerPax>0</b:MaxQuatityPerPax> <b:Name>Steak</b:Name> <b:QuantityAllocated>30</b:QuantityAllocated> <b:QuantityAvailable>30</b:QuantityAvailable> <b:ArrivalAirport xmlns:c="http://schemas.datacontract.org/2004/07/InteliSys.Amelia"> <c:Code>YUL</c:Code> <c:Name>Montreal</c:Name> </b:ArrivalAirport> <b:DepartureAirport xmlns:c="http://schemas.datacontract.org/2004/07/InteliSys.Amelia"> <c:Code>YQM</c:Code> <c:Name>Moncton</c:Name> </b:DepartureAirport> </b:CityPairItem> </b:Allocations> <b:AllowMultiple>true</b:AllowMultiple> <b:Description>Meals for testing</b:Description> <b:ID>12</b:ID> <b:Name>Test_Meals</b:Name> <b:TypeID>1</b:TypeID> <b:TypeName>Ancillary Items</b:TypeName> </b:CategoryOfCityPairAllocations>
In order to properly purchase a city pair ancillary item, the following XML must be present under the BookingPassenger node for the passenger that will recieve the item:
<int1:CityPairSSRs> <int1:BookingCityPairSSR> <int1:CityPairAllocID>1167</int1:CityPairAllocID> <int1:LegNumber>1</int1:LegNumber> <int1:Quantity>1</int1:Quantity> </int1:BookingCityPairSSR> </int1:CityPairSSRs>
The CityPairAllocID is pulled from the response of GetCityPairSSRAllocations response under the ID node. Now we'll add this item to the booking request:
<int:Query> <int1:Legs> <int1:BookingLeg> <int1:AdultFares> <int1:BookingClassCode>Y</int1:BookingClassCode> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:FareCode>Y</int1:FareCode> <int1:PaxCount>1</int1:PaxCount> <int1:TotalCost>179</int1:TotalCost> </int1:AdultFares> <int1:Segments> <int1:BookingSegment> <int1:ArrivalAirportCode>YUL</int1:ArrivalAirportCode> <int1:DepartureAirportCode>YQM</int1:DepartureAirportCode> <int1:ETALocal>2016-11-09T18:35:00</int1:ETALocal> <int1:ETDLocal>2016-11-09T17:15:00</int1:ETDLocal> <int1:FlightCode>WJ8316</int1:FlightCode> </int1:BookingSegment> </int1:Segments> </int1:BookingLeg> </int1:Legs> <int1:Passengers> <int1:BookingPassenger> <int1:AgeCategory>Adult</int1:AgeCategory> <int1:CityPairSSRs> <int1:BookingCityPairSSR> <int1:CityPairAllocID>51</int1:CityPairAllocID> <int1:LegNumber>1</int1:LegNumber> <int1:Quantity>1</int1:Quantity> </int1:BookingCityPairSSR> </int1:CityPairSSRs> <int1:DateOfBirth>1989-12-12</int1:DateOfBirth> <int1:DestinationTelephone>1234567891</int1:DestinationTelephone> <int1:Firstname>John</int1:Firstname> <int1:Gender>Male</int1:Gender> <int1:Lastname>Doe</int1:Lastname> <int1:Middlename>M</int1:Middlename> <int1:Title>Mr</int1:Title> </int1:BookingPassenger> </int1:Passengers> <int1:Payment> <int1:Amount>242.88</int1:Amount> <int1:CreditCardPayment> <int1:Address> <int1:Addr1>123 anywhere st</int1:Addr1> <int1:Addr2>apt 12</int1:Addr2> <int1:City>saint john</int1:City> <int1:CountryCode>CDN</int1:CountryCode> <int1:CountryDescription>Canada</int1:CountryDescription> <int1:PostalCode>e2e2e2</int1:PostalCode> <int1:ProvinceAbbreviation>nb</int1:ProvinceAbbreviation> <int1:ProvinceName>new brunswick</int1:ProvinceName> </int1:Address> <int1:CVV>377</int1:CVV> <int1:Email>email@email.com</int1:Email> <int1:ExpireYear>2017</int1:ExpireYear> <int1:ExpiryMonth>12</int1:ExpiryMonth> <int1:Firstname>John</int1:Firstname> <int1:Lastname>Doe</int1:Lastname> <int1:Number>4111111111111111</int1:Number> <int1:TypeCode>VI</int1:TypeCode> </int1:CreditCardPayment> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:PaymentType>CreditCard</int1:PaymentType> <int1:ProcessingFee>10</int1:ProcessingFee> <int1:ProcessingFeeTax>1.15</int1:ProcessingFeeTax> </int1:Payment> </int:Query>
NOTE: The cost of the SSR must be taken into consideration when calculating the total cost of the reservation. Not including the cost will cause the booking request to fail.
Step 4: Adding Seat Selections (Optional)
As of our 16.12 release it is now possible to set seat selections in the booking request. The details around how to do this can be found in this article.
Alternate Flows
Booking with a promo code
In order to see travel options with discounted amounts based on a promo code the promocode (and suffix if applicable) must be passed in the request. The travel options request at the beginning of this article would look as follows if the 'PROMOTION' promo code was applied:
https://InteliSys-api.intelisys.ca/RESTv1/InteliSys/travelOptions?cityPair=YQM-YUL&departure=2016-11-10&cabinClass=J¤cy=USD&adultCount=1&childCount=0&infantCount=0&daysBeforeDeparture=7&daysAfterDeparture=7&promoCode=PROMOTION
promoCodeApplicability:{ promoCodeRequested:true, promoCodeValidity:{ valid:true, notApplicable:false, noMarket:false, invalidFlightDate:false, notAvailable:false, invalidAvailability:false }, promoCode:"PROMOTION" }
fareCharges:[ { description:"Economy", bookingApplicability:{ allPassengers:true, primaryPassenger:false, optional:false }, passengerApplicability:{ adult:true, child:true, infant:false }, chargeType:{ code:"FA", description:"Fare", feeCategory:{ href:"/feeCategories/ATC" } }, currencyAmounts:[ { baseAmount:179, discountAmount:35.80000000000001, taxAmount:0, taxRateAmounts:[ ], totalAmount:143.2, currency:{ href:"/currencies/USD", code:"USD", description:"US dollars" } } ], taxConfiguration:{ feeCategory:null } }
In order to book this fare with the promocode applied we need to get some information that RESTv1 travel options does not return. To do this we're going to use the bookingApiBridge. The bookingApiBridge recieves the bookingKey returned under the fareOptions element in the travel options response. Here is a sample of the request:
https://InteliSys-api.intelisys.ca/RESTv1/InteliSys/bookingApiBridge/0FJĘpT3EOyPc8WgWxxONMtbxOdrsKatquCWb6FlLlĘdunbRpuBSZ855DXSVĘGFi0GArzKĀ„moMK6HSRlizuJWI5Ā„QFynrJDEifsQzhazyYbbXp26YLuN8MscNBlppa4SDz1YlpQĀ„wSpHoADhbRjOA8Q8nE15NNYjUdXqhZ8LHAmmczFinRxaZUjwYDA9Id7OYU6jcDQsxNUdO0p1cp4xmO5F3d2sO4T6mdXTMviSqIyRDIrHOXepMo6oLomvAvOcyoQQUEKIjwRYXIpRMPuqedw==
{ Ā Ā promoCodeId:47, Ā Ā promoCodeSuffixId:-1, Ā Ā bookingSegments:[ Ā Ā Ā Ā Ā { Ā Ā Ā Ā Ā Ā Ā Ā skedDetailId:142504 Ā Ā Ā Ā Ā } Ā Ā ] }
Now we'll add these values to the booking request:
<int:Query> <int1:Legs> <int1:BookingLeg> <int1:AdultFares> <int1:BookingClassCode>Y</int1:BookingClassCode> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:FareCode>Y</int1:FareCode> <int1:PaxCount>1</int1:PaxCount> <int1:TotalCost>143.20</int1:TotalCost> </int1:AdultFares> <int1:PromoCodeID>47</int1:PromoCodeID> <!-- If a promoCode is applicable for one BookingLeg it needs to be set for all BookingLegs --> <int1:PromoCodeSuffixID>-1</int1:PromoCodeSuffixID> <int1:Segments> <int1:BookingSegment> <int1:ArrivalAirportCode>YUL</int1:ArrivalAirportCode> <int1:DepartureAirportCode>YQM</int1:DepartureAirportCode> <int1:ETALocal>2016-11-09T18:35:00</int1:ETALocal> <int1:ETDLocal>2016-11-09T17:15:00</int1:ETDLocal> <int1:FlightCode>WJ8316</int1:FlightCode> </int1:BookingSegment> </int1:Segments> </int1:BookingLeg> </int1:Legs> <int1:Passengers> <int1:BookingPassenger> <int1:AgeCategory>Adult</int1:AgeCategory> <int1:DateOfBirth>1989-12-12</int1:DateOfBirth> <int1:DestinationTelephone>1234567891</int1:DestinationTelephone> <int1:Firstname>John</int1:Firstname> <int1:Gender>Male</int1:Gender> <int1:Lastname>Doe</int1:Lastname> <int1:Middlename>M</int1:Middlename> <int1:Title>Mr</int1:Title> </int1:BookingPassenger> </int1:Passengers> <int1:Payment> <int1:Amount>157.08</int1:Amount> <int1:CreditCardPayment> <int1:Address> <int1:Addr1>123 anywhere st</int1:Addr1> <int1:Addr2>apt 12</int1:Addr2> <int1:City>saint john</int1:City> <int1:CountryCode>CDN</int1:CountryCode> <int1:CountryDescription>Canada</int1:CountryDescription> <int1:PostalCode>e2e2e2</int1:PostalCode> <int1:ProvinceAbbreviation>nb</int1:ProvinceAbbreviation> <int1:ProvinceName>new brunswick</int1:ProvinceName> </int1:Address> <int1:CVV>377</int1:CVV> <int1:Email>email@email.com</int1:Email> <int1:ExpireYear>2017</int1:ExpireYear> <int1:ExpiryMonth>12</int1:ExpiryMonth> <int1:Firstname>John</int1:Firstname> <int1:Lastname>Doe</int1:Lastname> <int1:Number>4111111111111111</int1:Number> <int1:TypeCode>VI</int1:TypeCode> </int1:CreditCardPayment> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:PaymentType>CreditCard</int1:PaymentType> <int1:ProcessingFee>10</int1:ProcessingFee> <int1:ProcessingFeeTax>1.15</int1:ProcessingFeeTax> </int1:Payment> </int:Query>
This request is now ready to go.
As outlined previously where this reservation is being paid by credit card, the processing fees would need to be calculated prior to submitting the request.
Booking with a return trip
In order to see return trip travel options the 'return' parameter must be populated in the request. Here is the request URL I will use for this example:
https://InteliSys-api.intelisys.ca/RESTv1/InteliSys/traveloptions?cityPair=YQM-YUL&departure=2016-11-15&cabinClass=J¤cy=USD&adultCount=1&childCount=0&infantCount=0&daysBeforeDeparture=1&daysAfterDeparture=1&return=2016-11-20
<int:Query> <int1:Legs> <int1:BookingLeg> <int1:AdultFares> <int1:BookingClassCode>Y</int1:BookingClassCode> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:FareCode>Y</int1:FareCode> <int1:PaxCount>2</int1:PaxCount> <int1:TotalCost>358</int1:TotalCost> </int1:AdultFares> <int1:Segments> <int1:BookingSegment> <int1:ArrivalAirportCode>YUL</int1:ArrivalAirportCode> <int1:DepartureAirportCode>YQM</int1:DepartureAirportCode> <int1:ETALocal>2016-11-15T19:35:00</int1:ETALocal> <int1:ETDLocal>2016-11-15T17:15:00</int1:ETDLocal> <int1:FlightCode>YY3103030</int1:FlightCode> </int1:BookingSegment> </int1:Segments> </int1:BookingLeg> <int1:BookingLeg> <int1:AdultFares> <int1:BookingClassCode>Y</int1:BookingClassCode> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:FareCode>Y</int1:FareCode> <int1:PaxCount>2</int1:PaxCount> <int1:TotalCost>110</int1:TotalCost> </int1:AdultFares> <int1:Segments> <int1:BookingSegment> <int1:ArrivalAirportCode>YYZ</int1:ArrivalAirportCode> <int1:DepartureAirportCode>YUL</int1:DepartureAirportCode> <int1:ETALocal>2016-11-20T08:40:00</int1:ETALocal> <int1:ETDLocal>2016-11-20T07:40:00</int1:ETDLocal> <int1:FlightCode>YY3103030</int1:FlightCode> </int1:BookingSegment> <int1:BookingSegment> <int1:ArrivalAirportCode>YQM</int1:ArrivalAirportCode> <int1:DepartureAirportCode>YYZ</int1:DepartureAirportCode> <int1:ETALocal>2016-11-20T10:55:00</int1:ETALocal> <int1:ETDLocal>2016-11-20T09:15:00</int1:ETDLocal> <int1:FlightCode>YY3103030</int1:FlightCode> </int1:BookingSegment> </int1:Segments> </int1:BookingLeg> </int1:Legs> <int1:Passengers> <int1:BookingPassenger> <int1:AgeCategory>Adult</int1:AgeCategory> <int1:DateOfBirth>1989-12-12</int1:DateOfBirth> <int1:DestinationTelephone>1234567891</int1:DestinationTelephone> <int1:Firstname>John</int1:Firstname> <int1:Gender>Male</int1:Gender> <int1:Lastname>Doe</int1:Lastname> <int1:Middlename>M</int1:Middlename> <int1:Title>Mr</int1:Title> </int1:BookingPassenger> <int1:BookingPassenger> <int1:AgeCategory>Adult</int1:AgeCategory> <int1:DateOfBirth>1989-12-12</int1:DateOfBirth> <int1:DestinationTelephone>1234567891</int1:DestinationTelephone> <int1:Firstname>Jane</int1:Firstname> <int1:Gender>Female</int1:Gender> <int1:Lastname>Doe</int1:Lastname> <int1:Middlename>M</int1:Middlename> <int1:Title>Mr</int1:Title> </int1:BookingPassenger> </int1:Passengers> <int1:Payment> <int1:Amount>Total fare + surcharges + other applicable fees</int1:Amount> <int1:CreditCardPayment> <int1:Address> <int1:Addr1>123 anywhere st</int1:Addr1> <int1:Addr2>apt 12</int1:Addr2> <int1:City>saint john</int1:City> <int1:CountryCode>CDN</int1:CountryCode> <int1:CountryDescription>Canada</int1:CountryDescription> <int1:PostalCode>e2e2e2</int1:PostalCode> <int1:ProvinceAbbreviation>nb</int1:ProvinceAbbreviation> <int1:ProvinceName>new brunswick</int1:ProvinceName> </int1:Address> <int1:CVV>377</int1:CVV> <int1:Email>email@email.com</int1:Email> <int1:ExpireYear>2017</int1:ExpireYear> <int1:ExpiryMonth>12</int1:ExpiryMonth> <int1:Firstname>John</int1:Firstname> <int1:Lastname>Doe</int1:Lastname> <int1:Number>4111111111111111</int1:Number> <int1:TypeCode>VI</int1:TypeCode> </int1:CreditCardPayment> <int1:CurrencyCode>USD</int1:CurrencyCode> <int1:PaymentType>CreditCard</int1:PaymentType> <int1:ProcessingFee>10</int1:ProcessingFee> <int1:ProcessingFeeTax>1.15</int1:ProcessingFeeTax> </int1:Payment> </int:Query>
Request troubleshooting
In this section we'll cover common failure cases and how to troubleshoot them.
In the event of a failure when trying to book a reservation, the 'OperationMessage' element in the booking response will hold extra information regarding the nature of the error. The structure generally follows this scheme:
<a:OperationMessage>Amelia Error: %CODE% - Message: %MESSAGE% </a:OperationMessage>
Some of these errors do not return a descriptive error message accompanied with the error code. Here are some of the more common error codes and their descriptions:
Common error codes | ||
---|---|---|
Code | Cause | Solution |
-6998 | The reservation balance is greater than the given payment. | Ensure all applicable fees have been taken into consideration when calculating the total for the reservation. |
-65987 | The payment used will incur processing fees that were not acknowledged. | Ensure processing fees have been taken into consideration. |
-111 | No availability on one orĀ more items selected. (SSRs) | Ensure the SSR you're trying to purchase is available for purchase. |
-1111 | No fare availability. | Ensure the fare you're trying to book has not sold out/is available. |