使用节点 js 和 graphql 使用运营商代码过滤 amadeus flightsOffers
filtering amadeus flightsOffers using carriers code using node js and graphql
我必须使用 origin, destination, departureDate, carrier
过滤 flightOffer
但是我在将载体添加到参数时收到此错误消息
Some of the parameters were not recognized. Please check your query.
如何通过将承运人传递给 amadeus 查询来过滤结果??
查询
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 [];
}
};
通过查看您的代码,不清楚您是否使用 Flight Low-fare Search API or the Flight Offers Search API。
无论如何,这两个 API 都没有 carrier 参数。如果您想按航空公司过滤,您可以使用:
对于航班低价搜索:
- includeAirlines:要包含的航空公司 IATA 代码列表,以逗号分隔
- excludeAirlines:要排除的航空公司 IATA 代码列表,以逗号分隔
航班优惠搜索:
- includedAirlineCodes:要包含的航空公司 IATA 代码列表,以逗号分隔
- excludedAirlineCodes:要排除的航空公司 IATA 代码列表,以逗号分隔
我必须使用 origin, destination, departureDate, carrier
但是我在将载体添加到参数时收到此错误消息
Some of the parameters were not recognized. Please check your query.
如何通过将承运人传递给 amadeus 查询来过滤结果??
查询
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 [];
}
};
通过查看您的代码,不清楚您是否使用 Flight Low-fare Search API or the Flight Offers Search API。
无论如何,这两个 API 都没有 carrier 参数。如果您想按航空公司过滤,您可以使用:
对于航班低价搜索:
- includeAirlines:要包含的航空公司 IATA 代码列表,以逗号分隔
- excludeAirlines:要排除的航空公司 IATA 代码列表,以逗号分隔
航班优惠搜索:
- includedAirlineCodes:要包含的航空公司 IATA 代码列表,以逗号分隔
- excludedAirlineCodes:要排除的航空公司 IATA 代码列表,以逗号分隔