使用Amadeus航班搜索API:低价品牌舱位售罄无法获取高价舱位的咨询
Amadeus航班搜索API:基础经济舱售罄时获取美联航经济舱详情的问题
问题描述
我正在使用自助服务门户的Amadeus航班搜索API,此前使用正常,但遇到一个技术问题:美联航的ECONOMY舱包含**基础经济舱(basic economy)和美联航经济舱(united economy)**两种品牌舱位。通过航班报价搜索API查询时,系统默认返回最低价格的基础经济舱,之后可通过branded fare upselling API获取美联航经济舱的详情。但当基础经济舱售罄时,API并未自动返回美联航经济舱,导致无法获取该舱位的航班信息。这应该是参数设置问题,请问如何调整才能获取该航班的美联航经济舱详情?
当前使用的搜索参数
params = { "currencyCode": "USD", "originDestinations": [ { "id": "1", "originLocationCode": "EWR", "destinationLocationCode": "SBP", "departureDateTimeRange": { "date": "2023-10-12" } }, { "id": "2", "originLocationCode": "SBP", "destinationLocationCode": "EWR", "departureDateTimeRange": { "date": "2023-10-21" } } ], "travelers": [ { "id": "1", "travelerType": "ADULT" } ], "sources": ["GDS"], "searchCriteria": { "additionalInformation": { "brandedFares": True }, "allowAlternativeFareOptions": True, "flightFilters": { "carrierRestrictions": { "includedCarrierCodes": ["UA"] }, "cabinRestrictions": [ { "cabin": "ECONOMY", "coverage": "MOST_SEGMENTS", "originDestinationIds": ["1"] }, { "cabin": "ECONOMY", "coverage": "MOST_SEGMENTS", "originDestinationIds": ["2"] } ] } } }
解决方案
1. 新增品牌舱筛选规则
在searchCriteria中添加fareOptions字段,直接指定需要的品牌舱类型,或者排除基础经济舱:
"searchCriteria": { "additionalInformation": { "brandedFares": True }, "allowAlternativeFareOptions": True, "fareOptions": { # 排除基础经济舱,强制返回其他经济舱品牌 "excludedFareBrands": ["UA_BASIC_ECONOMY"] # 或者直接指定只返回美联航经济舱 # "includedFareBrands": ["UA_ECONOMY"] }, "flightFilters": { # 原有过滤器内容保留 } }
注意:UA的品牌代码需以Amadeus GDS的标准代码为准,常见基础经济舱代码为UA Basic Economy或UA_BASIC,可通过Amadeus元数据API确认准确值。
2. 开启全价选项返回
在searchCriteria中添加returnAllFareOptions: true,让API返回该舱位下所有可用的品牌舱选项,而非仅最低价格的:
"searchCriteria": { "additionalInformation": { "brandedFares": True }, "allowAlternativeFareOptions": True, "returnAllFareOptions": True, # 新增此参数 "flightFilters": { # 原有过滤器内容保留 } }
这样即使基础经济舱售罄,API会直接返回剩余可用的美联航经济舱选项,无需二次调用branded fare upselling API。
3. 调整舱位覆盖范围
将cabinRestrictions中的coverage从MOST_SEGMENTS改为ALL_SEGMENTS,确保全程筛选ECONOMY舱的所有品牌类型:
"cabinRestrictions": [ { "cabin": "ECONOMY", "coverage": "ALL_SEGMENTS", # 修改此处 "originDestinationIds": ["1"] }, { "cabin": "ECONOMY", "coverage": "ALL_SEGMENTS", # 修改此处 "originDestinationIds": ["2"] } ]
内容的提问来源于stack exchange,提问作者MTT_Paiback
相关产品推荐
相关产品推荐

