Skip to content

Latest commit

 

History

History
494 lines (365 loc) · 23.6 KB

Air.md

File metadata and controls

494 lines (365 loc) · 23.6 KB

Air ✈️

The Air workflow allows you to do what most travel agents did in the past and what many search engines still do today: book a trip for a customer. Air service provides:

  • Air Shop: Search for flight options by lowest fare (LowFareSearch(Asynch)Req) or availability (AirAvailability).
  • Air Price: Price the selected flights and request additional information about rules, flight details, and seating.
  • Air Book: Book the flights when you are satisfied with the times, price, and rules.

API

AirService

.shop(params)

Low Fare Shop functionality combines air availability and a fare quote request to return the lowest available fares for a specified itinerary, using origin/destination and date information. Fares are available for one-way, round-trip, and multi-city travel. Low Fare Shop does not require a booked itinerary to return fare data.

Returns: Promise See: Low Fare Shopping Model

Param Type Description
legs Array<Leg> See Leg description below.
passengers Search Passengers See Search Passengers description below.
pricing Pricing See Pricing modifiers description below. Optional.
cabins Array<Cabin> See Cabins array description below.
requestId string Trace id of this request. Optional.
maxJourneyTime number Maximum travel time in hours 0-99. Total for all legs Optional.
solutionResult Boolean Set true to retrieve AirPricingSolution, default is False (retrieves AirPricePoint. Optional.
maxSolutions number Maximum number of solutions. Optional.
permittedCarriers Array<String> Array of carriers' codes. Optional. Can not be used when preferredCarriers is set
preferredCarriers Array<String> Array of carriers' codes. Optional. Can not be used when permittedCarriers is set
allowDirectAccess Boolean When passed, first carrier is taken from the carriers list and the search is done in carrier specific display. Optional.
returnFirstAvailableOnly Boolean When passed, next days availability is returned if available. Optional.
preferredConnectionPoints Array<String> Array of IATA codes. Optional.
prohibitedConnectionPoints Array<String> Array of IATA codes. Optional.
permittedConnectionPoints Array<String> Array of IATA codes. Optional.
async Boolean Use this flag to use LowFareSearchAsynch. Default value is false.Optional. See Low Fare Shopping (Asynchronous)
faresOnly Boolean Use this flag to retrieve traceId, searchId, hasMoreResult with the fare data. Default value is false. Optional.

Pricing object

Param Type Description
currency String Currency to convert results prices.
eTicketability Boolean Detect if pricing solution will be ticketable as e-ticket.

Leg object

Each leg represents one part of the journey. For example, a typical roundtrip IEV-PAR-IEV should have two legs: IEV-PAR and PAR-IEV. An open-jaw route would still consist of two legs, e.g. IEV-PAR, AMS-IEV. For a more complicated route, more than two legs can be requested.

Param Type Description
from String IATA code.
to String IATA code.
departureDate String Date in format YYYY-MM-DD.

Search Passengers object

Param Type Description
ADT Number Adults count.
INF Number Infants count ( < 2 years ) .
CNN Number Children count ( < 12 years ).
Other types Number Other IATA Passenger Type Codes available (see uAPI documentation).

Cabins array

The cabins array lists requested cabin types, currently Economy or Business or both.

See: Shop example

.retrieveShop(params)

If Low Fare Shop Async request has more results in cache, use this method to retrieve remaining results. This method should return the data in a format similar to a standard shop() results.

Returns: Promise See: Retrieving Low Fare Search Data

.fareRules(params)

For fetching detailed fare rules after itinerary selection this method is used.

Returns: Promise See: Fare Rules

Param Type Description
segments Array<Segment> See Segment description below.
passengers Book Passengers See Book Passengers description below.
long boolean true to fetch long explanations, false to fetch short ones.
requestId String Unique ID to identify request and response in profiler logs

See: farerules example

.book(params)

After searching for air segments and fares, air bookings are created using the results from an Air Pricing response. Book is aggregated function which do AirPrice request before making booking request. So you don't need to make AirPrice request manually.

Returns: Promise See: Create Air Booking

Param Type Description
segments Array<Segment> See Segment description below.
passengers Book Passengers See Book Passengers description below.
phone Phone Booking agency/traveller phone. See Phone description below.
rule String Custom check rule.
allowWaitlist Boolean Allow open waitlisted segments, do not cancel booking. See allowWaitlist description below.
deliveryInformation Delivery Information Optional. See Delivery Information description below.
tau String/Date/Array<Number> Optional. Takes See TAU description below. The default value is 3 hours from the current timestamp.
platingCarrier String Optional. PlatingCarrier.
overrideContinuityCheck Boolean Optional. Sets ContinuityCheckOverride.

Segment object

Each search response has Directions array which represents different variations of the same trip (with same price), but with the different flight options. Each index of Directions array represents leg index. For example if you have IEV-PAR-IEV roundtrip search request it will have IEV-PAR, PAR-IEV legs. And Directions array will have length 2. Under Directions[0] and Directions[1] will be different options for the flight. So under Directions[0][1] you will find Segments array. This segments are used for booking. Please specify transfer field to mark connection segment.

Segment object sample.

{
  "from": "KBP",
  "to": "AMS",
  "bookingClass": "G",
  "departure": "2016-11-10T19:40:00.000+02:00",
  "arrival": "2016-11-10T21:45:00.000+01:00",
  "airline": "KL",
  "flightNumber": "3098",
  "serviceClass": "Economy",
  "plane": "E90",
  "fareBasisCode": "GSRUA",
  "group": 0
}

Book Passengers object

Param Type Description
lastName String Passenger last name.
firstName String Passenger first name.
title String One of ['MR', 'MS', 'MSTR', 'MISS'].
birthDate String Birth date in format YYYY-MM-DD.
gender String One of ['M', 'F'].
ageCategory String One of ['ADT', 'CNN', 'INF']. Or other types
passNumber String Pass number.
passCountry String 2-letter code of country.
ssr Array<SSR> Optional. SSR requests. See SSR description below..

SSR object

Param Type Description
type String SSR Type code eg. CHLD, CTCR, DOCS, DOCA, FOID.
carrier String Optional. 2-letter IATA Code of airline, default is YY
status String Optional. Status eg. NN, PN, UN, HK
freeText String SSR FreeText

Phone object

Param Type Description
location String City code of the phone number origin.
countryCode String Country code, prepending telephone number.
number String Phone number.

allowWaitlist

Default behavior is to cancel the entire Universal Record when part of the booking has failed. This includes both open and closed waitlisting and other errors. With allowWaitlist=true the UR is canceled only for a closed wait list, but open waitlist reservation is kept and returned to user.

Delivery info object

Param Type Description
name String First and last name of the delivery recipient
street String Street address
zip String Postal code
country String Country
city String City

TAU - Ticketing Arrangement

Ticketing Arrangement is an optional param used for domestic purposes of agents to specify assumed date/time of booking.

The default value is 3 hours from the current timestamp.

The tau option represents an ISO 8601 format, Date object or Array of numbers.

To see the list of all available formats, please use the following documentation.

See: Book example

.ticket(params)

This library is designed to do getBooking right after ticketing is finished with success. Ticketing is typically included as a follow-on request to an Air Booking response. Any number of tickets can be issued from one Stored Fare Quote when a booking has multiple passengers. Tickets can also be issued when there is more than one Stored Fare Quote in the PNR. Ticketing function returns true if the process is finished with success or Error. Returns: Promise(true | Error). See: Air Ticketing

Param Type Description
commission Object {type: String "Z"|ZA", value: Number 50 } Values for both percentage and amount types are numbers, currency for amount type will be calculated automatically based on the information from booking's FQs. Ex: amount - { commission: { type: ZA, value: 10 }}, percent - { commission: { type: Z, value: 50 } }.
fop Form Of Payment See Form Of Payment description below.
pnr String 1G PNR.

Form of payment

Warning: Currently only Cash FOP is supported.

Param Type Description
type String Form of payment type. See docs

See: Ticketing example

.toQueue(params)

The Queue Place functionality adds a specific booking (PNR) to a queue in the provider system for a specific Pseudo City Code. If a Universal Record (UR) does not exist for the PNR, it is placed in the queue anyway, but PNR Import is not completed for the UR database.

Returns: Promise(true | Error). See: Queue managment

Param Type Description
pcc String PCC to place booking.
queue String Queue number to place booking.
pnr String 1G PNR.

See: Queue example

.getUniversalRecordByPNR(params)

May require Terminal access enabled in uAPI. See TerminalService

This method returns an array of all PNR objects, which are contained in Universal record, holding the PNR provided. If Universal record does not exists it is being created and PNR is imported into created Universal record.

If the PNR contains no active segments it could not be imported into uAPI. Thus library tries to add OPEN segment to he PNR, using TerminalService, importing PNR and then removing created segment.

Returns: Promise. - All Information for requested PNR. See: Importing PNR

Param Type Description
pnr String 1G PNR.
viewOnly Boolean When true is passed, booking is retrieved in UR Format, but doesn't create an actual UR in UAPI. When false is passed, UR is created and booking is retrieved from actual UR. Default false.

See: Example

.getUniversalRecord(params)

This method returns an array of all PNR objects, which are contained in Universal record, holding the PNR provided. If Universal record does not exists RuntimeError.AirRuntimeError "Record locator not found" will be raised.

Returns: Promise. - All Information for requested Universal Record. See: Retrieving a Universal Record with a Known Locator

Param Type Description
universalRecordLocatorCode String uAPI Record Locator Code

See: Example

.getBooking(params)

May require Terminal access enabled in uAPI. See TerminalService

This method executes getUniversalRecordByPNR and then returns single PNR object from its output.

Returns: Promise. - All Information for requested PNR. See: Importing PNR

Param Type Description
pnr String 1G PNR.
viewOnly Boolean When true is passed, booking is retrieved in UR Format, but doesn't create an actual UR in UAPI. When false is passed, UR is created and booking is retrieved from actual UR. Default false.

See: getBooking example

.flightInfo(params)

Request for the flight information.

Returns: Promise See: Flight Information

Param Type Description
airline string The marketing carrier for the segment.
departure string The departure date; either the current date or a date in the future, not include the time zone which is derived from the origin location.
flightNumber string The flight number for the segment

See: FlightInfo basic example, FlightInfo multiple items example

.getBookingByTicketNumber(params)

Requires Terminal access enabled in uAPI. See TerminalService

Request for the ticket information.

Returns: Promise, which is fullfilled with PNR as String

This function executes terminal command to get PNR from *TE command response.

Param Type Description
ticketNumber String The number of the ticket.

See: getBookingByTicketNumber example

.getTicket(params)

May require Terminal access enabled in uAPI. See TerminalService

Request for the ticket information.

Returns: Promise See: Ticket Information

Param Type Description
ticketNumber String The number of the ticket.

See: getTicket example

.getTickets(params)

May require Terminal access enabled in uAPI. See TerminalService

Request for the ticket information for all tickets in PNR. First gets information about PNR, which allows to tell if credentials are allowed to list tickets for the PNR. Also automatically fetched UR locator, so PNR only should be provided.

Returns: Promise See: Ticket Information

Param Type Description
pnr String 1G PNR.

See: getTickets example

.searchBookingsByPassengerName(params)

Requires Terminal access enabled in uAPI. See TerminalService

Searches for PNRs in PCC, that match provided searchPhrase. Returns single PNR or a list.

Returns: Promise with next shape { type: 'list' | 'pnr', data: Array | String }

This function executes terminal command to get passengers list from *-NAME command response.

Param Type Description
searchPhrase String Last name to look for.

While function returns object with type list it means that Array is returned. Example of list response:

  {
    type: 'list',
    data: [
      { id: 1, firstName: 'John', lastName: 'Kovalski', pnr: 'PNR001', date, isCancelled },
      { id: 2, firstName: 'Inna', lastName: 'Kovalchuk', pnr: 'PNR002', date, isCancelled },
    ]
  }

When type equals pnr than data field contains pnr string.

See: getBookingByTicketNumber example

.cancelTicket(params)

May require Terminal access enabled in uAPI. See TerminalService

Gets ticket information with getTicket and then tries to cancel it.

Returns: Promise which is resolved with true

Param Type Description
ticketNumber String Ticket number.

See: cancelTicket example

.cancelBooking(params)

May require Terminal access enabled in uAPI. See TerminalService

Gets pnr information and tickets list from importPNR and then do one of following actions:

  • if PNR has tickets and all of them have status VOID, REFUND or both of them, then tries to cancel PNR
  • if PNR has tickets and no cancelTickets flag is set, error is returned
  • if PNR has tickets and cancelTickets flag set to true, checks tickets
    • if PNR has only tickets with VOID or OPEN coupons, then tickets are cancelled, then the booking is cancelled
    • if PNR contains tickets with coupons having other statuses, then error is returned
  • if ignoreTickets flag set to true, all tickets in PNR will be ignored, regardless of their status and cancelTickets flag

Returns: Promise which is resolved with true

Param Type Description
pnr String PNR
cancelTickets Boolean Defines if tickets should be cancelled or not
ignoreTickets Boolean Defines if tickets should be ignored. The default value is false

See: cancelBooking example

.addSegments(params)

Add segments to an existing reservation record.

Returns: Promise which is resolved with response message.

Param Type Description
pnr String PNR
segments Array Segments required to add
version Number Optional. Current uAPI record version
universalRecordLocatorCode String Optional. uAPI universal locator code
reservationLocatorCode String Optional. uAPI reservation locator code

It is recommended to pass version param in order to ensure that the last version of the PNR was reviewed before modification.

.getEMDList(params)

May require Terminal access enabled in uAPI. See TerminalService

Request for the EMD information for all issued EMD in PNR. You will get both: EMD-S/EMD-A

Returns: Promise See: Ticket Information

Param Type Description
pnr String 1G PNR.

See: getEMDList example

.getEMDItem(params)

May require Terminal access enabled in uAPI. See TerminalService

Request for the emd information. You can get any type (EMD-S/EMD-A) by number.

Returns: Promise See: Ticket Information

Param Type Description
pnr String 1G PNR.
emdNumber String EMD Number.

See: getEMDItem example