### Install Amadeus Node.js SDK Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Instructions to install the Amadeus Node.js SDK using npm. ```sh npm install amadeus --save ``` -------------------------------- ### Search Flight Offers (POST) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Searches for flight offers using a POST request with a request body. A full example can be found in the Amadeus code examples repository. ```js amadeus.shopping.flightOffersSearch.post(body) ``` -------------------------------- ### Perform Arbitrary GET API Call with Amadeus Node.js SDK Client Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Illustrates making a direct GET request to any API path using the `amadeus.client.get` method, providing flexibility for custom calls. ```js amadeus.client.get('/v2/reference-data/urls/checkin-links', { airlineCode: 'BA' }); ``` -------------------------------- ### Search Flight Offers (GET) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Searches for flight offers based on origin, destination, departure date, and number of adults using the Amadeus Flight Offers Search API (GET method). ```js amadeus.shopping.flightOffersSearch.get({ originLocationCode: 'SYD', destinationLocationCode: 'BKK', departureDate: '2022-11-01', adults: '2' }) ``` -------------------------------- ### Perform GET API Call with Nested Path in Amadeus Node.js SDK Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Demonstrates how to make a GET request to a nested API path, mapping the Amadeus API structure to the SDK's object model. ```js amadeus.referenceData.urls.checkinLinks.get({ airlineCode: 'BA' }); ``` -------------------------------- ### Price Flight Offers Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves pricing details for a flight offer obtained from a flight offers search. This example demonstrates chaining the search and pricing calls. ```js amadeus.shopping.flightOffersSearch.get({ originLocationCode: 'SYD', destinationLocationCode: 'BKK', departureDate: '2022-11-01', adults: '1' }).then(function(response){ return amadeus.shopping.flightOffers.pricing.post( { 'data': { 'type': 'flight-offers-pricing', 'flightOffers': [response.data[0]] } } ) }).then(function(response){ console.log(response.data); }).catch(function(responseError){ console.log(responseError); }); ``` -------------------------------- ### Create Flight Orders Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Books flight offers returned by the Flight Offers Price API and creates a flight order with traveler information. A full example is available on GitHub. ```js amadeus.booking.flightOrders.post( { 'type': 'flight-order', 'flightOffers': [priced-offers], 'travelers': [] } ); ``` -------------------------------- ### Get Travel Recommendations (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Provides recommended locations based on city codes and the traveler's country code. ```JavaScript amadeus.referenceData.recommendedLocations.get({ cityCodes: 'PAR', travelerCountryCode: 'FR' }) ``` -------------------------------- ### Get Activity by ID (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Extracts detailed information about a specific tour or activity using its unique ID. ```JavaScript amadeus.shopping.activity('56777').get() ``` -------------------------------- ### Get Hotels by City Code Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves a list of hotels by a specified city code using the Amadeus Reference Data API. ```js amadeus.referenceData.locations.hotels.byCity.get({ cityCode: 'PAR' }) ``` -------------------------------- ### Get Tours and Activities by Geolocation (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Finds the best tours and activities available around a specific geographical point (latitude and longitude). ```JavaScript amadeus.shopping.activities.get({ latitude: 41.397158, longitude: 2.160873 }) ``` -------------------------------- ### Get Flight Check-in Links Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves check-in links for a specified airline using the Amadeus Reference Data API. ```js amadeus.referenceData.urls.checkinLinks.get({ airlineCode : 'BA' }) ``` -------------------------------- ### Predict Flight Choice Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Predicts the likelihood of a flight choice based on flight offers. This example demonstrates chaining search and prediction calls. ```js amadeus.shopping.flightOffersSearch.get({ originLocationCode: 'SYD', destinationLocationCode: 'BKK', departureDate: '2022-11-01', adults: '2' }).then(function(response){ return amadeus.shopping.flightOffers.prediction.post(response); }).then(function(response){ console.log(response.data); }).catch(function(responseError){ console.log(responseError); }); ``` -------------------------------- ### Perform GET API Call for Resource by ID in Amadeus Node.js SDK Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Shows how to access a specific resource by its ID using the singular path method in the Amadeus SDK. ```js amadeus.shopping.hotelOffer('123').get(...); ``` -------------------------------- ### Get Airport On-time Performance (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves the percentage of on-time flight departures from a specified airport on a given date. ```JavaScript amadeus.airport.predictions.onTime.get({ airportCode: 'JFK', date: '2022-18-01' }) ``` -------------------------------- ### Get Point of Interest by ID (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Extracts detailed information about a specific point of interest using its unique ID. ```JavaScript amadeus.referenceData.locations.pointOfInterest('9CB40CB5D0').get() ``` -------------------------------- ### Get Direct Destinations from Airport Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves a list of direct destinations from a specified departure airport using the Amadeus Airport Routes API. ```js amadeus.airport.directDestinations.get({ departureAirportCode: 'CDG' }) ``` -------------------------------- ### Get Points of Interest by Geolocation (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Finds popular places (points of interest) within a specified radius around a given latitude and longitude. ```JavaScript amadeus.referenceData.locations.pointsOfInterest.get({ latitude : 41.397158, longitude : 2.160873 }) ``` -------------------------------- ### Get Tours and Activities by Square Area (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves tours and activities within a defined square geographical area, specified by north, west, south, and east coordinates. ```JavaScript amadeus.shopping.activities.bySquare.get({ north: 41.397158, west: 2.160873, south: 41.394582, east: 2.177181 }) ``` -------------------------------- ### Get City or Airport by ID Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves details for a specific city or airport based on its unique ID using the Amadeus Reference Data API. ```js amadeus.referenceData.location('ALHR').get() ``` -------------------------------- ### Get Hotel Sentiment Analysis (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves sentiment analysis of reviews for specific hotels based on their IDs. This provides insights into public opinion about hotels. ```JavaScript amadeus.eReputation.hotelSentiments.get({ hotelIds: 'XKPARC12' }) ``` -------------------------------- ### Get Hotels by Hotel IDs (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves specific hotels using their unique Amadeus hotel identifiers. This allows direct lookup of known hotel properties. ```JavaScript amadeus.referenceData.locations.hotels.byHotels.get({ hotelIds: 'ACPAR245' }) ``` -------------------------------- ### Display Flight Seat Map from Search Results Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves the seat map for each flight included in flight offers obtained from a flight search. This example demonstrates chaining search and seat map calls. ```js amadeus.shopping.flightOffersSearch.get({ originLocationCode: 'SYD', destinationLocationCode: 'BKK', departureDate: '2022-11-01', adults: '1' }).then(function(response){ return amadeus.shopping.seatmaps.post( { 'data': [response.data[0]] } ); }).then(function(response){ console.log(response.data); }).catch(function(responseError){ console.log(responseError); }); ``` -------------------------------- ### Get Hotels by City Code (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves a list of hotels based on a specified city code. This uses the Amadeus Hotels API to find accommodations in a particular urban area. ```JavaScript amadeus.referenceData.locations.hotels.byCity.get({ cityCode: 'PAR' }) ``` -------------------------------- ### Get Points of Interest by Square Area (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves popular places within a defined square geographical area, specified by north, west, south, and east coordinates. ```JavaScript amadeus.referenceData.locations.pointsOfInterest.bySquare.get({ north: 41.397158, west: 2.160873, south: 41.394582, east: 2.177181 }) ``` -------------------------------- ### Get On-Demand Flight Status (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves the current status of a specific flight. This requires the carrier code, flight number, and scheduled departure date. ```JavaScript amadeus.schedule.flights.get({ carrierCode: 'AZ', flightNumber: '319', scheduledDepartureDate: '2021-03-13' }) ``` -------------------------------- ### Get Hotels by Geocode (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Fetches a list of hotels using geographical coordinates (latitude and longitude). This is useful for finding hotels around a specific point on the map. ```JavaScript amadeus.referenceData.locations.hotels.byGeocode.get({ latitude: 48.83152, longitude: 2.24691 }) ``` -------------------------------- ### Get Most Traveled Flight Destinations Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves the most traveled flight destinations from a given origin city for a specified period using the Amadeus Travel Analytics API. ```js amadeus.travel.analytics.airTraffic.traveled.get({ originCityCode : 'MAD', period : '2017-01' }) ``` -------------------------------- ### Get Most Booked Flight Destinations Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves the most booked flight destinations from a given origin city for a specified period using the Amadeus Travel Analytics API. ```js amadeus.travel.analytics.airTraffic.booked.get({ originCityCode : 'MAD', period : '2017-08' }) ``` -------------------------------- ### Get Location Score for Category Rated Areas (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves location analytics data for category-rated areas based on geographical coordinates. This provides insights into the quality of an area. ```JavaScript amadeus.location.analytics.categoryRatedAreas.get({ latitude : 41.397158, longitude : 2.160873 }) ``` -------------------------------- ### Get Busiest Flight Traveling Period Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves the busiest traveling period for a specified city and year, indicating whether it's for arriving or departing traffic, using the Amadeus Travel Analytics API. ```js amadeus.travel.analytics.airTraffic.busiestPeriod.get({ cityCode: 'MAD', period: '2017', direction: Amadeus.direction.arriving }) ``` -------------------------------- ### Initialize Amadeus Node.js SDK with API Keys Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Shows how to initialize the Amadeus client by directly providing `clientId` and `clientSecret` parameters. ```js // Initialize using parameters const amadeus = new Amadeus({ clientId: 'REPLACE_BY_YOUR_API_KEY', clientSecret: 'REPLACE_BY_YOUR_API_SECRET' }); ``` -------------------------------- ### Make First API Call with Amadeus Node.js SDK Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Demonstrates how to initialize the Amadeus client with API keys and perform a flight offers search, logging the response or error. ```js const Amadeus = require('amadeus'); const amadeus = new Amadeus({ clientId: 'REPLACE_BY_YOUR_API_KEY', clientSecret: 'REPLACE_BY_YOUR_API_SECRET' }); amadeus.shopping.flightOffersSearch.get({ originLocationCode: 'SYD', destinationLocationCode: 'BKK', departureDate: '2022-06-01', adults: '2' }).then(function(response){ console.log(response.data); }).catch(function(responseError){ console.log(responseError.code); }); ``` -------------------------------- ### Initialize Amadeus Node.js SDK using Environment Variables Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Illustrates initializing the Amadeus client without parameters, relying on `AMADEUS_CLIENT_ID` and `AMADEUS_CLIENT_SECRET` environment variables. ```js const amadeus = new Amadeus(); ``` -------------------------------- ### Configure Amadeus Node.js SDK for Production Environment Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Explains how to switch the Amadeus SDK to the production environment by setting the `hostname` parameter during initialization. ```js const amadeus = new Amadeus({ hostname: 'production' }); ``` -------------------------------- ### Book Hotel (V1) (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Creates a hotel booking using the Hotel Booking API v1. This version requires an offer ID, guest details, payment information, and room details. ```JavaScript amadeus.booking.hotelBookings.post( { 'data': { 'offerId': 'XXXX', 'guests': [], 'payments': [], 'rooms': [] } } ) ``` -------------------------------- ### Perform Arbitrary POST API Call with Amadeus Node.js SDK Client Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Demonstrates making a direct POST request to any API path using the `amadeus.client.post` method, useful for submitting data. ```js amadeus.client.post('/v1/shopping/flight-offers/pricing', { data }); ``` -------------------------------- ### Navigate Paginated Amadeus API Responses in JavaScript Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Illustrates how to access subsequent pages of an API endpoint that supports pagination using the .next, .previous, .last, and .first methods. It shows fetching the first and second pages of location data. ```js amadeus.referenceData.locations.get({ keyword: 'LON', subType: 'AIRPORT,CITY' }).then(function(response){ console.log(response.data); // first page return amadeus.next(response); }).then(function(nextResponse){ console.log(nextResponse.data); // second page }); ``` -------------------------------- ### Book Hotel Order (V2) (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Creates a new hotel booking order using the Hotel Booking API v2. This endpoint requires detailed guest, payment, and room association information. ```JavaScript amadeus.booking.hotelOrders.post( { 'data': { 'type': 'hotel-order', 'guests': [], 'travelAgent': {}, 'roomAssociations': [], 'payment': {} } } ) ``` -------------------------------- ### Configure Custom Logger for Amadeus SDK in JavaScript Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Shows how to integrate a custom logger, compatible with the default console, into the Amadeus Node.js SDK during initialization. This allows for flexible logging mechanisms. ```js const amadeus = new Amadeus({ clientId: 'REPLACE_BY_YOUR_API_KEY', clientSecret: 'REPLACE_BY_YOUR_API_SECRET', logger: new MyConsole() }); ``` -------------------------------- ### Search Flight Availabilities Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Searches for flight availabilities using a POST request with a request body. ```js amadeus.shopping.availability.flightAvailabilities.post(body); ``` -------------------------------- ### Search Hotel Offers by Hotel IDs (V3) (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Searches for available hotel offers for specific hotels based on their IDs and the number of adults. This uses the Hotel Search API V3 to find booking options. ```JavaScript amadeus.shopping.hotelOffersSearch.get({ hotelIds: 'RTPAR001', adults: '2' }) ``` -------------------------------- ### Enable Debug Logging Level in Amadeus SDK in JavaScript Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Explains how to set the logging level to 'debug' during SDK initialization to enable more verbose logging. This is useful for detailed debugging and troubleshooting. ```js const amadeus = new Amadeus({ clientId: 'REPLACE_BY_YOUR_API_KEY', clientSecret: 'REPLACE_BY_YOUR_API_SECRET', logLevel: 'debug' }); ``` -------------------------------- ### Price Flight Offers with Additional Parameters Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Prices flight offers including additional parameters, such as baggage options, by providing a request body and options. ```js amadeus.shopping.flightOffers.pricing.post(body ,{include: 'bags'}); ``` -------------------------------- ### Analyze Flight Price Metrics (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Analyzes itinerary price metrics for a given origin, destination, and departure date. ```JavaScript amadeus.analytics.itineraryPriceMetrics.get({ originIataCode: 'MAD', destinationIataCode: 'CDG', departureDate: '2022-03-13', }) ``` -------------------------------- ### Search Transfer Offers (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Searches for available transfer offers. This API call typically requires a request body with search criteria. ```JavaScript amadeus.shopping.transferOffers.post(body); ``` -------------------------------- ### Book Transfer by Offer ID (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Books a transfer based on a specific offer ID. This requires a request body and the offer ID. ```JavaScript amadeus.ordering.transferOrders.post(body, offerId='2094123123'); ``` -------------------------------- ### Search Cities by Keyword Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Finds cities that match a specific word or string of letters, returning a list of cities matching the keyword 'Paris' using the Amadeus Reference Data API. ```js amadeus.referenceData.locations.cities.get({ keyword: 'Paris' }) ``` -------------------------------- ### Handle Amadeus API Call Promises in JavaScript Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Demonstrates how to handle successful and failed API calls using Promises in the Amadeus Node.js SDK. It shows accessing raw body, parsed result, and data attributes for success, and response object, request details, and error code for failures. ```js amadeus.referenceData.urls.checkinLinks.get({ airlineCode: 'BA' }).then(function(response){ console.log(response.body); //=> The raw body console.log(response.result); //=> The fully parsed result console.log(response.data); //=> The data attribute taken from the result }).catch(function(error){ console.log(error.response); //=> The response object with (un)parsed data console.log(error.response.request); //=> The details of the request made console.log(error.code); //=> A unique error code to identify the type of error }); ``` -------------------------------- ### Search Flight Inspiration Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Searches for flight inspiration destinations from a given origin city using the Amadeus Flight Inspiration Search API. ```js amadeus.shopping.flightDestinations.get({ origin : 'MAD' }) ``` -------------------------------- ### Check Hotel Offer Conditions by Offer ID (V3) (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves the detailed conditions and information for a specific hotel offer using its unique offer ID. This is part of the Hotel Search API V3. ```JavaScript amadeus.shopping.hotelOfferSearch('XXX').get() ``` -------------------------------- ### Autocomplete Airports and Cities Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Finds all cities and airports matching a keyword for autocomplete functionality using the Amadeus Reference Data API. ```js amadeus.referenceData.locations.get({ keyword : 'LON', subType : Amadeus.location.any }) ``` -------------------------------- ### Upsell Branded Fares Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Performs an upsell operation for branded fares using a POST request with a request body. ```js amadeus.shopping.flightOffers.upselling.post(body); ``` -------------------------------- ### Search Cheapest Flight Dates Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Finds the cheapest flight dates between a specified origin and destination using the Amadeus Flight Cheapest Date Search API. ```js amadeus.shopping.flightDates.get({ origin : 'MAD', destination : 'MUC' }) ``` -------------------------------- ### Autocomplete Hotel Names Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Provides autocomplete functionality for hotel search fields based on a keyword and subtype using the Amadeus Reference Data API. ```js amadeus.referenceData.locations.hotel.get({ keyword: 'PARI', subType: 'HOTEL_GDS' }) ``` -------------------------------- ### Find Destinations Served by Airline Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Finds all destinations served by a given airline using the Amadeus Airline Routes API. ```js amadeus.airline.destinations.get({ airlineCode: 'BA' }) ``` -------------------------------- ### Retrieve Flight Order by ID Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves details of a specific flight order using its ID, which is obtained from the Flight Create Orders API. ```js amadeus.booking.flightOrder('XXX').get() ``` -------------------------------- ### Lookup Airline Codes Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Looks up airline information based on provided airline codes using the Amadeus Reference Data API. ```js amadeus.referenceData.airlines.get({ airlineCodes : 'U2' }) ``` -------------------------------- ### Display Flight Seat Map by Order ID Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Retrieves the seat map for a specific flight order using its ID. ```js amadeus.shopping.seatmaps.get({ 'flight-orderId': 'XXX' }); ``` -------------------------------- ### Predict Flight Delay (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Predicts potential flight delays based on various parameters like origin, destination, dates, times, aircraft, carrier, and flight number. ```JavaScript amadeus.travel.predictions.flightDelay.get({ originLocationCode: 'BRU', destinationLocationCode: 'FRA', departureDate: '2020-01-14', departureTime: '11:05:00', arrivalDate: '2020-01-14', arrivalTime: '12:10:00', aircraftCode: '32A', carrierCode: 'LH', flightNumber: '1009', duration: 'PT1H05M' }) ``` -------------------------------- ### Predict Trip Purpose (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Forecasts whether a traveler's purpose is Business or Leisure, along with the probability, based on origin, destination, and travel dates. ```JavaScript amadeus.travel.predictions.tripPurpose.get({ originLocationCode: 'NYC', destinationLocationCode: 'MAD', departureDate: '2021-04-01', returnDate: '2021-04-08' }) ``` -------------------------------- ### Find Nearest Relevant Airport Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Finds the nearest relevant airport based on provided longitude and latitude coordinates using the Amadeus Reference Data API. ```js amadeus.referenceData.locations.airports.get({ longitude : 0.1278, latitude : 51.5074 }) ``` -------------------------------- ### Cancel Transfer by Order ID and Confirmation Number (Node.js) Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Cancels an existing transfer using its order ID and confirmation number. ```JavaScript amadeus.ordering.transferOrder('XXX').transfers.cancellation.post({}, confirmNbr='12345'); ``` -------------------------------- ### Cancel Flight Order by ID Source: https://github.com/amadeus4dev/amadeus-node/blob/master/README.md Cancels a specific flight order using its ID, which is obtained from the Flight Create Orders API. ```js amadeus.booking.flightOrder('XXX').delete() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.