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:

NameDescriptionTypeAdditional 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&currency=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.

Ā Here is the travel option I'm going to use for this example:
{  
   href:"/travelOptions/vFDeK6B0ujTlTH94nAO1w%C2%A5z4uSTHCbjxHpbPU%C6%92WEnodvjfCW6i3aU%C6%92DoMDyCTU0vlC1KrGFP%C2%A5WUgWdHknWbcjmr%C2%A5mnB9SoxddDE%C2%A5uFHiA8lJv%C2%A5WmX2IGWUnFErh9UMUu%C6%92zDk4tN3aeb%C6%924V7TPO8gagkCDuNTjkGvseqrLzpA3QBOu14jKP7mliD4OttUjvuW",
   key:"vFDeK6B0ujTlTH94nAO1wĀ„z4uSTHCbjxHpbPUʒWEnodvjfCW6i3aUʒDoMDyCTU0vlC1KrGFPĀ„WUgWdHknWbcjmrĀ„mnB9SoxddDEĀ„uFHiA8lJvĀ„WmX2IGWUnFErh9UMUuʒzDk4tN3aebʒ4V7TPO8gagkCDuNTjkGvseqrLzpA3QBOu14jKP7mliD4OttUjvuW",
   cityPair:{  
      href:"/cityPairs/YQM-YUL",
      identifier:"YQM-YUL"
   },
   departureDate:"2016-11-09",
   enRouteHours:1.3333,
   numberOfStops:1,
   numberOfChanges:0,
   flights:[  
      {  
         airlineCode:{  
            code:"YY"
         },
         flightNumber:"3103030",
         departure:{  
            scheduledTime:"2016-11-09 21:15:00Z",
            airport:{  
               href:"/airports/YQM",
               code:"YQM",
               name:"Moncton",
               utcOffset:{  
                  iso:"-04:00",
                  hours:-4,
                  minutes:-240
               }
            }
         },
         arrival:{  
            scheduledTime:"2016-11-09 23:35:00Z",
            airport:{  
               href:"/airports/YUL",
               code:"YUL",
               name:"Montreal",
               utcOffset:{  
                  iso:"-05:00",
                  hours:-5,
                  minutes:-300
               }
            }
         },
         aircraftModel:{  
            identifier:"737-900",
            name:"737-900ER"
         }
      }
   ],
   fareOptions:[  
      {  
         bookingKey:"0FJʒpT3EOyPc8WgWxxONMtbxOdrsKatquCWb6FlLlʒdunbRpuBSZ855DXSVʒGFi0GArzKĀ„moMK6HSRlizuJWI5Ā„QFynrJDEifsQzhazyYbbXp26YLuN8MscNBlppa4SDz1YlpQĀ„wSpHoADhbRjOA8Q8nE15NNYjUdXqhZ8LHAmn5knUJ8TCtĀ„oNrCqĀ„FoUCJMZfJ9kcgayvvKGiIoiYwRNNhenQ9sbDtRALJVi3ab9OegNgLUxzK04GjWiyEqkW9rteOlTt0mp6PodAjBPtwJA==",
         fareValidity:{  
            valid:true,
            soldOut:false,
            noFare:false,
            invalidAdultAvailability:false,
            invalidChildAvailability:false,
            invalidAvailability:false,
            invalidLayover:false,
            invalidStayover:false
         },
         fareClass:{  
            code:"Y",
            description:"Economy",
            passengerApplicability:{  
               adult:true,
               child:true
            },
            allowWaitlist:true,
            seatSelectionChargeApplicability:{  
               bookingCode:true,
               seatType:true
            }
         },
         bookingCode:{  
            code:"Y"
         },
         cabinClass:{  
            href:"/cabinClasses/J",
            code:"J",
            description:"Economy"
         },
         fareType:{  
            href:"/fareTypes/2",
            identifier:"Unrestricted",
            description:"Unrestricted"
         },
         availability:180,
         cheapestFareType:true,
         cheapestFareOption:true,
         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:0,
                     taxAmount:0,
                     taxRateAmounts:[  

                     ],
                     totalAmount:179,
                     currency:{  
                        href:"/currencies/USD",
                        code:"USD",
                        description:"US dollars"
                     }
                  }
               ],
               taxConfiguration:{  
                  feeCategory:null
               }
            },
            {  
               description:"Seat Assignment",
               bookingApplicability:{  
                  allPassengers:true,
                  primaryPassenger:false,
                  optional:true
               },
               passengerApplicability:{  
                  adult:true,
                  child:true,
                  infant:false
               },
               chargeType:{  
                  code:"SA",
                  description:"Seat Assignment",
                  feeCategory:{  
                     href:"/feeCategories/ATC"
                  }
               },
               currencyAmounts:[  
                  {  
                     baseAmount:25,
                     discountAmount:0,
                     taxAmount:0,
                     taxRateAmounts:[  

                     ],
                     totalAmount:25,
                     currency:{  
                        href:"/currencies/USD",
                        code:"USD",
                        description:"US dollars"
                     }
                  }
               ],
               taxConfiguration:{  
                  feeCategory:null
               }
            },
            {  
               description:"YQM - Moncton AIF",
               bookingApplicability:{  
                  allPassengers:true,
                  primaryPassenger:false,
                  optional:false
               },
               passengerApplicability:{  
                  adult:true,
                  child:true,
                  infant:false
               },
               chargeType:{  
                  code:"AI",
                  description:"Airport Improvement Fund",
                  feeCategory:{  
                     href:"/feeCategories/TFC"
                  }
               },
               currencyAmounts:[  
                  {  
                     baseAmount:5,
                     discountAmount:0,
                     taxAmount:0,
                     taxRateAmounts:[  

                     ],
                     totalAmount:5,
                     currency:{  
                        href:"/currencies/USD",
                        code:"USD",
                        description:"US dollars"
                     }
                  }
               ],
               taxConfiguration:{  
                  feeCategory:null
               }
            },
            {  
               description:"LengthTestLengthTestLengthTestLengthTestLengthTest",
               bookingApplicability:{  
                  allPassengers:false,
                  primaryPassenger:true,
                  optional:false
               },
               passengerApplicability:{  
                  adult:true,
                  child:true,
                  infant:false
               },
               chargeType:{  
                  code:"HA",
                  description:"Handling Fee",
                  feeCategory:{  
                     href:"/feeCategories/ATC"
                  }
               },
               currencyAmounts:[  
                  {  
                     baseAmount:8.88,
                     discountAmount:0,
                     taxAmount:0,
                     taxRateAmounts:[  

                     ],
                     totalAmount:8.88,
                     currency:{  
                        href:"/currencies/USD",
                        code:"USD",
                        description:"US dollars"
                     }
                  }
               ],
               taxConfiguration:{  
                  feeCategory:null
               }
            },
            {  
               description:"Security Risk",
               bookingApplicability:{  
                  allPassengers:true,
                  primaryPassenger:false,
                  optional:false
               },
               passengerApplicability:{  
                  adult:true,
                  child:true,
                  infant:false
               },
               chargeType:{  
                  code:"SF",
                  description:"Security Fee",
                  feeCategory:{  
                     href:"/feeCategories/TFC"
                  }
               },
               currencyAmounts:[  
                  {  
                     baseAmount:0,
                     discountAmount:0,
                     taxAmount:0,
                     taxRateAmounts:[  

                     ],
                     totalAmount:0,
                     currency:{  
                        href:"/currencies/USD",
                        code:"USD",
                        description:"US dollars"
                     }
                  }
               ],
               taxConfiguration:{  
                  feeCategory:null
               }
            }
         ],
         promoCodeApplied:false
      }
   ],
   promoCodeApplicability:{  
      promoCodeRequested:false,
      promoCodeValidity:{  
         valid:false,
         notApplicable:true,
         noMarket:false,
         invalidFlightDate:false,
         notAvailable:false,
         invalidAvailability:false
      },
      promoCode:""
   }
}

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>

This basic reservation is now ready to book on hold. Next, we'll add in some payment information. This example will add a credit card payment however there is support for various other payment methods (see this documentation for more info).

            <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>

Often there are processing fees associated with paying for a booking via credit card. To get these fees use the CalculateProcessingFee operation under the Booking Service in APIv3. The CalculateProcessingFee operation takes the booking request and returns applicable processing fees (if any). Below is a sample of this request.

   <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>

As you can see, it's structure is very similar to the BookReservation request. The response would look similar to the sample shown below.

         <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>

Now that the processing fees have been calculated, the reservation is ready to be booked. Below is the fully populated 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>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&currency=USD&adultCount=1&childCount=0&infantCount=0&daysBeforeDeparture=7&daysAfterDeparture=7&promoCode=PROMOTION
Ā Consequently, you will see in the response the discounted value for the fare:
{  
   href:"/travelOptions/vFDeK6B0ujTlTH94nAO1w%C2%A5z4uSTHCbjxHpbPU%C6%92WEnodvjfCW6i3aU%C6%92DoMDyCTU0vlC1KrGFP%C2%A5WUgWdHknWbcjmr%C2%A5mnB9SoxddDE%C2%A5uFHiA8lJv%C2%A5WmX2IGWUnFErh9UMUu9oA4ZnfotY4hQQq2e34oF9KKOPRPMGvjR9Pn8ANzNw70VRKkrNiNq7jKptNJw%C6%92QWdA09k154XHEJENQZExaQBA==",
   key:"vFDeK6B0ujTlTH94nAO1wĀ„z4uSTHCbjxHpbPUʒWEnodvjfCW6i3aUʒDoMDyCTU0vlC1KrGFPĀ„WUgWdHknWbcjmrĀ„mnB9SoxddDEĀ„uFHiA8lJvĀ„WmX2IGWUnFErh9UMUu9oA4ZnfotY4hQQq2e34oF9KKOPRPMGvjR9Pn8ANzNw70VRKkrNiNq7jKptNJwʒQWdA09k154XHEJENQZExaQBA==",
   cityPair:{  
      href:"/cityPairs/YQM-YUL",
      identifier:"YQM-YUL"
   },
   departureDate:"2016-11-09",
   enRouteHours:1.3333,
   numberOfStops:1,
   numberOfChanges:0,
   flights:[  
      {  
         airlineCode:{  
            code:"YY"
         },
         flightNumber:"3103030",
         departure:{  
            scheduledTime:"2016-11-09 21:15:00Z",
            airport:{  
               href:"/airports/YQM",
               code:"YQM",
               name:"Moncton",
               utcOffset:{  
                  iso:"-04:00",
                  hours:-4,
                  minutes:-240
               }
            }
         },
         arrival:{  
            scheduledTime:"2016-11-09 23:35:00Z",
            airport:{  
               href:"/airports/YUL",
               code:"YUL",
               name:"Montreal",
               utcOffset:{  
                  iso:"-05:00",
                  hours:-5,
                  minutes:-300
               }
            }
         },
         aircraftModel:{  
            identifier:"737-900",
            name:"737-900ER"
         }
      }
   ],
   fareOptions:[  
      {  
         bookingKey:"0FJʒpT3EOyPc8WgWxxONMtbxOdrsKatquCWb6FlLlʒdunbRpuBSZ855DXSVʒGFi0GArzKĀ„moMK6HSRlizuJWI5Ā„QFynrJDEifsQzhazyYbbXp26YLuN8MscNBlppa4SDz1YlpQĀ„wSpHoADhbRjOA8Q8nE15NNYjUdXqhZ8LHAmmczFinRxaZUjwYDA9Id7OYU6jcDQsxNUdO0p1cp4xmO5F3d2sO4T6mdXTMviSqIyRDIrHOXepMo6oLomvAvOcyoQQUEKIjwRYXIpRMPuqedw==",
         fareValidity:{  
            valid:true,
            soldOut:false,
            noFare:false,
            invalidAdultAvailability:false,
            invalidChildAvailability:false,
            invalidAvailability:false,
            invalidLayover:false,
            invalidStayover:false
         },
         fareClass:{  
            code:"Y",
            description:"Economy",
            passengerApplicability:{  
               adult:true,
               child:true
            },
            allowWaitlist:true,
            seatSelectionChargeApplicability:{  
               bookingCode:true,
               seatType:true
            }
         },
         bookingCode:{  
            code:"Y"
         },
         cabinClass:{  
            href:"/cabinClasses/J",
            code:"J",
            description:"Economy"
         },
         fareType:{  
            href:"/fareTypes/2",
            identifier:"Unrestricted",
            description:"Unrestricted"
         },
         availability:180,
         cheapestFareType:true,
         cheapestFareOption:true,
         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
               }
            },
            {  
               description:"Seat Assignment",
               bookingApplicability:{  
                  allPassengers:true,
                  primaryPassenger:false,
                  optional:true
               },
               passengerApplicability:{  
                  adult:true,
                  child:true,
                  infant:false
               },
               chargeType:{  
                  code:"SA",
                  description:"Seat Assignment",
                  feeCategory:{  
                     href:"/feeCategories/ATC"
                  }
               },
               currencyAmounts:[  
                  {  
                     baseAmount:25,
                     discountAmount:0,
                     taxAmount:0,
                     taxRateAmounts:[  

                     ],
                     totalAmount:25,
                     currency:{  
                        href:"/currencies/USD",
                        code:"USD",
                        description:"US dollars"
                     }
                  }
               ],
               taxConfiguration:{  
                  feeCategory:null
               }
            },
            {  
               description:"YQM - Moncton AIF",
               bookingApplicability:{  
                  allPassengers:true,
                  primaryPassenger:false,
                  optional:false
               },
               passengerApplicability:{  
                  adult:true,
                  child:true,
                  infant:false
               },
               chargeType:{  
                  code:"AI",
                  description:"Airport Improvement Fund",
                  feeCategory:{  
                     href:"/feeCategories/TFC"
                  }
               },
               currencyAmounts:[  
                  {  
                     baseAmount:5,
                     discountAmount:0,
                     taxAmount:0,
                     taxRateAmounts:[  

                     ],
                     totalAmount:5,
                     currency:{  
                        href:"/currencies/USD",
                        code:"USD",
                        description:"US dollars"
                     }
                  }
               ],
               taxConfiguration:{  
                  feeCategory:null
               }
            },
            {  
               description:"LengthTestLengthTestLengthTestLengthTestLengthTest",
               bookingApplicability:{  
                  allPassengers:false,
                  primaryPassenger:true,
                  optional:false
               },
               passengerApplicability:{  
                  adult:true,
                  child:true,
                  infant:false
               },
               chargeType:{  
                  code:"HA",
                  description:"Handling Fee",
                  feeCategory:{  
                     href:"/feeCategories/ATC"
                  }
               },
               currencyAmounts:[  
                  {  
                     baseAmount:8.88,
                     discountAmount:0,
                     taxAmount:0,
                     taxRateAmounts:[  

                     ],
                     totalAmount:8.88,
                     currency:{  
                        href:"/currencies/USD",
                        code:"USD",
                        description:"US dollars"
                     }
                  }
               ],
               taxConfiguration:{  
                  feeCategory:null
               }
            },
            {  
               description:"Security Risk",
               bookingApplicability:{  
                  allPassengers:true,
                  primaryPassenger:false,
                  optional:false
               },
               passengerApplicability:{  
                  adult:true,
                  child:true,
                  infant:false
               },
               chargeType:{  
                  code:"SF",
                  description:"Security Fee",
                  feeCategory:{  
                     href:"/feeCategories/TFC"
                  }
               },
               currencyAmounts:[  
                  {  
                     baseAmount:0,
                     discountAmount:0,
                     taxAmount:0,
                     taxRateAmounts:[  

                     ],
                     totalAmount:0,
                     currency:{  
                        href:"/currencies/USD",
                        code:"USD",
                        description:"US dollars"
                     }
                  }
               ],
               taxConfiguration:{  
                  feeCategory:null
               }
            }
         ],
         promoCodeApplied:true
      }
   ],
   promoCodeApplicability:{  
      promoCodeRequested:true,
      promoCodeValidity:{  
         valid:true,
         notApplicable:false,
         noMarket:false,
         invalidFlightDate:false,
         notAvailable:false,
         invalidAvailability:false
      },
      promoCode:"PROMOTION"
   }
}

Lets Take a closer look at of the following portion of the response.

   promoCodeApplicability:{  
      promoCodeRequested:true,
      promoCodeValidity:{  
         valid:true,
         notApplicable:false,
         noMarket:false,
         invalidFlightDate:false,
         notAvailable:false,
         invalidAvailability:false
      },
      promoCode:"PROMOTION"
   }

Here we can see that the promocode passed in the request is valid. Also, looking under the fareCharges element we can see the discounted total.

         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==

In the response you can see the value for promocode ID and Suffix ID which will be required for the booking request.

{
Ā Ā  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&currency=USD&adultCount=1&childCount=0&infantCount=0&daysBeforeDeparture=1&daysAfterDeparture=1&return=2016-11-20


You can also optionally supply various other criteria to open or restrict the return travel options.

Ā Here is the outbound travel option I have chosen to use for this example.
{
   "href":"/travelOptions/vFDeK6B0ujTlTH94nAO1w%C2%A5z4uSTHCbjxHpbPU%C6%92WEnofuli%C6%92fovOze1y690fRBE9cG%C2%A5aXBnGJ4GfRAnpHJ7CNpCVW3lNz0FjtElck38%C6%92QxPnKT3kPmD9P5Etu1GBF6J0UCBDst596%C2%A5iEudcUAvyqaQh04Y1p9XELiD8O4RQ5iZat%C2%A5yKbAnFxG6ht1%C6%925I574JjePZvkZRqjxfYwdnRM9%C2%A59QQ==",
   "key":"vFDeK6B0ujTlTH94nAO1wĀ„z4uSTHCbjxHpbPUʒWEnofuliʒfovOze1y690fRBE9cGĀ„aXBnGJ4GfRAnpHJ7CNpCVW3lNz0FjtElck38ʒQxPnKT3kPmD9P5Etu1GBF6J0UCBDst596Ā„iEudcUAvyqaQh04Y1p9XELiD8O4RQ5iZatĀ„yKbAnFxG6ht1ʒ5I574JjePZvkZRqjxfYwdnRM9Ā„9QQ==",
   "cityPair":{
      "href":"/cityPairs/YQM-YUL",
      "identifier":"YQM-YUL"
   },
   "departureDate":"2016-11-15",
   "enRouteHours":1.3333,
   "numberOfStops":1,
   "numberOfChanges":0,
   "flights":[
      {
         "airlineCode":{
            "code":"YY"
         },
         "flightNumber":"3103030",
         "departure":{
            "scheduledTime":"2016-11-15 21:15:00Z",
            "airport":{
               "href":"/airports/YQM",
               "code":"YQM",
               "name":"Moncton",
               "utcOffset":{
                  "iso":"-04:00",
                  "hours":-4,
                  "minutes":-240
               }
            }
         },
         "arrival":{
            "scheduledTime":"2016-11-15 23:35:00Z",
            "airport":{
               "href":"/airports/YUL",
               "code":"YUL",
               "name":"Montreal",
               "utcOffset":{
                  "iso":"-05:00",
                  "hours":-5,
                  "minutes":-300
               }
            }
         },
         "aircraftModel":{
            "identifier":"737-900",
            "name":"737-900ER"
         }
      }
   ],
   "fareOptions":[
      {
         "bookingKey":"0FJʒpT3EOyPc8WgWxxONMj4KrcpSRTVX618I8O0SGVCPF8bjYH42A0Mv4lESVwqwegQp00eOĀ„x4sKURkĀ„GqWeKDgFn6DXsxVt5REa0r71LwdVaOB4LhsESqvcCHUr3LURtViJSmemWoSQʒ1D6PPF8arloXZm05TnjbUlQTqn7eLdJBGWVcV1dCfJnlH0q7iuKpxĀ„l2l9sL7Pb0yCYgPwqmIGgtSTzij6bosdnN1bLWLul3zI1XuZJZKFSL6fmN836wWRS7Zs7IjrSiSAFIPDyg==",
         "fareValidity":{
            "valid":true,
            "soldOut":false,
            "noFare":false,
            "invalidAdultAvailability":false,
            "invalidChildAvailability":false,
            "invalidAvailability":false,
            "invalidLayover":false,
            "invalidStayover":false
         },
         "fareClass":{
            "code":"Y",
            "description":"Economy",
            "passengerApplicability":{
               "adult":true,
               "child":true
            },
            "allowWaitlist":true,
            "seatSelectionChargeApplicability":{
               "bookingCode":true,
               "seatType":true
            }
         },
         "bookingCode":{
            "code":"Y"
         },
         "cabinClass":{
            "href":"/cabinClasses/J",
            "code":"J",
            "description":"Economy"
         },
         "fareType":{
            "href":"/fareTypes/2",
            "identifier":"Unrestricted",
            "description":"Unrestricted"
         },
         "availability":180,
         "cheapestFareType":true,
         "cheapestFareOption":true,
         "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":0,
                     "taxAmount":0,
                     "taxRateAmounts":[

                     ],
                     "totalAmount":179,
                     "currency":{
                        "href":"/currencies/USD",
                        "code":"USD",
                        "description":"US dollars"
                     }
                  }
               ],
               "taxConfiguration":{
                  "feeCategory":null
               }
            },
            {
               "description":"Seat Assignment",
               "bookingApplicability":{
                  "allPassengers":true,
                  "primaryPassenger":false,
                  "optional":true
               },
               "passengerApplicability":{
                  "adult":true,
                  "child":true,
                  "infant":false
               },
               "chargeType":{
                  "code":"SA",
                  "description":"Seat Assignment",
                  "feeCategory":{
                     "href":"/feeCategories/ATC"
                  }
               },
               "currencyAmounts":[
                  {
                     "baseAmount":25,
                     "discountAmount":0,
                     "taxAmount":0,
                     "taxRateAmounts":[

                     ],
                     "totalAmount":25,
                     "currency":{
                        "href":"/currencies/USD",
                        "code":"USD",
                        "description":"US dollars"
                     }
                  }
               ],
               "taxConfiguration":{
                  "feeCategory":null
               }
            },
            {
               "description":"YQM   - Moncton AIF",
               "bookingApplicability":{
                  "allPassengers":true,
                  "primaryPassenger":false,
                  "optional":false
               },
               "passengerApplicability":{
                  "adult":true,
                  "child":true,
                  "infant":false
               },
               "chargeType":{
                  "code":"AI",
                  "description":"Airport Improvement Fund",
                  "feeCategory":{
                     "href":"/feeCategories/TFC"
                  }
               },
               "currencyAmounts":[
                  {
                     "baseAmount":5,
                     "discountAmount":0,
                     "taxAmount":0,
                     "taxRateAmounts":[

                     ],
                     "totalAmount":5,
                     "currency":{
                        "href":"/currencies/USD",
                        "code":"USD",
                        "description":"US dollars"
                     }
                  }
               ],
               "taxConfiguration":{
                  "feeCategory":null
               }
            },
            {
               "description":"LengthTestLengthTestLengthTestLengthTestLengthTest",
               "bookingApplicability":{
                  "allPassengers":false,
                  "primaryPassenger":true,
                  "optional":false
               },
               "passengerApplicability":{
                  "adult":true,
                  "child":true,
                  "infant":false
               },
               "chargeType":{
                  "code":"HA",
                  "description":"Handling Fee",
                  "feeCategory":{
                     "href":"/feeCategories/ATC"
                  }
               },
               "currencyAmounts":[
                  {
                     "baseAmount":8.88,
                     "discountAmount":0,
                     "taxAmount":0,
                     "taxRateAmounts":[

                     ],
                     "totalAmount":8.88,
                     "currency":{
                        "href":"/currencies/USD",
                        "code":"USD",
                        "description":"US dollars"
                     }
                  }
               ],
               "taxConfiguration":{
                  "feeCategory":null
               }
            },
            {
               "description":"Security Risk",
               "bookingApplicability":{
                  "allPassengers":true,
                  "primaryPassenger":false,
                  "optional":false
               },
               "passengerApplicability":{
                  "adult":true,
                  "child":true,
                  "infant":false
               },
               "chargeType":{
                  "code":"SF",
                  "description":"Security Fee",
                  "feeCategory":{
                     "href":"/feeCategories/TFC"
                  }
               },
               "currencyAmounts":[
                  {
                     "baseAmount":0,
                     "discountAmount":0,
                     "taxAmount":0,
                     "taxRateAmounts":[

                     ],
                     "totalAmount":0,
                     "currency":{
                        "href":"/currencies/USD",
                        "code":"USD",
                        "description":"US dollars"
                     }
                  }
               ],
               "taxConfiguration":{
                  "feeCategory":null
               }
            }
         ],
         "promoCodeApplied":false
      }
Ā Here is the inbound travel option I have chosen to use for this example.
{
   "href":"/travelOptions/vFDeK6B0ujTlTH94nAO1w%C2%A5z4uSTHCbjxHpbPU%C6%92WEnofuli%C6%92fovOze1y690fRBE9cG%C2%A5aXBnGJ4GfRAnpHJ7CNpCVW3lNz0FjtElck38%C6%92QxPnKT3kPmD9P5Etu1GBF6J0UCBDst596%C2%A5iEudcUAvyqaQi2G8Tfcbnoo1ML9xhfiwCYTKQDLTx3tCYhQIbSj9xAp%C6%92%C2%A56N06NB0BvQJI5gAqs00w==",
   "key":"vFDeK6B0ujTlTH94nAO1wĀ„z4uSTHCbjxHpbPUʒWEnofuliʒfovOze1y690fRBE9cGĀ„aXBnGJ4GfRAnpHJ7CNpCVW3lNz0FjtElck38ʒQxPnKT3kPmD9P5Etu1GBF6J0UCBDst596Ā„iEudcUAvyqaQi2G8Tfcbnoo1ML9xhfiwCYTKQDLTx3tCYhQIbSj9xApʒĀ„6N06NB0BvQJI5gAqs00w==",
   "cityPair":{
      "href":"/cityPairs/YUL-YQM",
      "identifier":"YUL-YQM"
   },
   "departureDate":"2016-11-20",
   "enRouteHours":4.25,
   "numberOfStops":2,
   "numberOfChanges":0,
   "flights":[
      {
         "airlineCode":{
            "code":"YY"
         },
         "flightNumber":"3103030",
         "departure":{
            "scheduledTime":"2016-11-21 00:40:00Z",
            "airport":{
               "href":"/airports/YUL",
               "code":"YUL",
               "name":"Montreal",
               "utcOffset":{
                  "iso":"-05:00",
                  "hours":-5,
                  "minutes":-300
               }
            }
         },
         "arrival":{
            "scheduledTime":"2016-11-21 01:40:00Z",
            "airport":{
               "href":"/airports/YYZ",
               "code":"YYZ",
               "name":"Toronto Pearson Intl",
               "utcOffset":{
                  "iso":"-05:00",
                  "hours":-5,
                  "minutes":-300
               }
            }
         },
         "aircraftModel":{
            "identifier":"737-900",
            "name":"737-900ER"
         }
      },
      {
         "airlineCode":{
            "code":"YY"
         },
         "flightNumber":"3103030",
         "departure":{
            "scheduledTime":"2016-11-21 02:15:00Z",
            "airport":{
               "href":"/airports/YYZ",
               "code":"YYZ",
               "name":"Toronto Pearson Intl",
               "utcOffset":{
                  "iso":"-05:00",
                  "hours":-5,
                  "minutes":-300
               }
            }
         },
         "arrival":{
            "scheduledTime":"2016-11-21 03:55:00Z",
            "airport":{
               "href":"/airports/YQM",
               "code":"YQM",
               "name":"Moncton",
               "utcOffset":{
                  "iso":"-04:00",
                  "hours":-4,
                  "minutes":-240
               }
            }
         },
         "aircraftModel":{
            "identifier":"737-900",
            "name":"737-900ER"
         }
      }
   ],
   "fareOptions":[
      {
         "bookingKey":"PrUwwXtRq6TSdqRiY5UhqvbMvsQM0N7dPozqPqXAClALdwanoHlwNHIz5C4eLiaS6LzTʒARoaCMQEʒCFv60SHAysBQg5votp9fx8MKʒhQYGRxXpxuHptUXuknWWlKpcNgyDUiFkqzcHiZeLd2JYHx0jY7zCOuZVi8jW5w1B5qMjcpNgqe8wWWaupp1WUiLeĀ„oyEJ9bqh5Sg90MmBq7UilGvPRAiOutdNiiNBL6AC0WuuUiJKTNĀ„3VYkrhNpaHRmf4ghZmXaL0AAuʒaObhPqohl9e5qnmc4llxfhhU9gmzuqpjnxʒdDvp9NlXErKaIIIX",
         "fareValidity":{
            "valid":true,
            "soldOut":false,
            "noFare":false,
            "invalidAdultAvailability":false,
            "invalidChildAvailability":false,
            "invalidAvailability":false,
            "invalidLayover":false,
            "invalidStayover":false
         },
         "fareClass":{
            "code":"Y",
            "description":"Economy",
            "passengerApplicability":{
               "adult":true,
               "child":true
            },
            "allowWaitlist":true,
            "seatSelectionChargeApplicability":{
               "bookingCode":true,
               "seatType":true
            }
         },
         "bookingCode":{
            "code":"Y"
         },
         "cabinClass":{
            "href":"/cabinClasses/J",
            "code":"J",
            "description":"Economy"
         },
         "fareType":{
            "href":"/fareTypes/2",
            "identifier":"Unrestricted",
            "description":"Unrestricted"
         },
         "availability":180,
         "cheapestFareType":true,
         "cheapestFareOption":true,
         "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":55,
                     "discountAmount":0,
                     "taxAmount":0,
                     "taxRateAmounts":[

                     ],
                     "totalAmount":55,
                     "currency":{
                        "href":"/currencies/USD",
                        "code":"USD",
                        "description":"US dollars"
                     }
                  }
               ],
               "taxConfiguration":{
                  "feeCategory":null
               }
            },
            {
               "description":"Seat Assignment",
               "bookingApplicability":{
                  "allPassengers":true,
                  "primaryPassenger":false,
                  "optional":true
               },
               "passengerApplicability":{
                  "adult":true,
                  "child":true,
                  "infant":false
               },
               "chargeType":{
                  "code":"SA",
                  "description":"Seat Assignment",
                  "feeCategory":{
                     "href":"/feeCategories/ATC"
                  }
               },
               "currencyAmounts":[
                  {
                     "baseAmount":25,
                     "discountAmount":0,
                     "taxAmount":0,
                     "taxRateAmounts":[

                     ],
                     "totalAmount":25,
                     "currency":{
                        "href":"/currencies/USD",
                        "code":"USD",
                        "description":"US dollars"
                     }
                  }
               ],
               "taxConfiguration":{
                  "feeCategory":null
               }
            },
            {
               "description":"Security Risk",
               "bookingApplicability":{
                  "allPassengers":true,
                  "primaryPassenger":false,
                  "optional":false
               },
               "passengerApplicability":{
                  "adult":true,
                  "child":true,
                  "infant":false
               },
               "chargeType":{
                  "code":"SF",
                  "description":"Security Fee",
                  "feeCategory":{
                     "href":"/feeCategories/TFC"
                  }
               },
               "currencyAmounts":[
                  {
                     "baseAmount":0,
                     "discountAmount":0,
                     "taxAmount":0,
                     "taxRateAmounts":[

                     ],
                     "totalAmount":0,
                     "currency":{
                        "href":"/currencies/USD",
                        "code":"USD",
                        "description":"US dollars"
                     }
                  }
               ],
               "taxConfiguration":{
                  "feeCategory":null
               }
            }
         ],
         "promoCodeApplied":false
      }

Below is a sample of what the structure of the request should look like to book both of these travel options.

            <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

CodeCauseSolution
-6998The 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.
-111No availability on one orĀ  more items selected. (SSRs)Ensure the SSR you're trying to purchase is available for purchase.
-1111No fare availability.Ensure the fare you're trying to book has not sold out/is available.