Ad
Filtering Amadeus FlightsOffers Using Carriers Code Using Node Js And Graphql
I have to filter the flightOffer using origin, destination, departureDate, carrier
but I've got this error message when adding carrier to parametres
Some of the parameters were not recognized. Please check your query.
How can I filter the result by passing carrier to amadeus query ??
the query
import * as Sentry from '@sentry/node';
import amadeus from './../../../../amadeus';
export default async (parent, args, context, info) => {
try {
const { result } = await amadeus.shopping.flightOffers.get({
origin: args.filter.origin,
destination: args.filter.destination,
departureDate: args.filter.departureDate,
carrier: args.filter.carrier
});
context.dictionaries =await result.dictionaries;
return result.data;
} catch (error) {
console.log(error);
Sentry.captureException(error);
return [];
}
};
Ad
Answer
By looking at your code it is not clear if you use the Flight Low-fare Search API or the Flight Offers Search API.
In any case, those 2 APIs do not have a carrier parameter. If you want to filter by airlines you can use:
For Flight Low-fare Search:
- includeAirlines: List of airline IATA codes to include, comma-separated
- excludeAirlines: List of airline IATA codes to exclude, comma-separated
For Flight Offers Search:
- includedAirlineCodes: List of airline IATA codes to include, comma-separated
- excludedAirlineCodes: List of airline IATA codes to exclude, comma-separated
Ad
source: stackoverflow.com
Related Questions
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error
Ad