You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Amadeus API调用问题:查询参数无效

解决Amadeus API获取值机链接时的"INVALID OPTION"(无效查询参数)错误

下面是几个可按优先级尝试的排查方向:

  • 确认航空公司代码的有效性
    虽然你用了AF、DL这类标准IATA两字码,但测试环境可能仅支持特定航司。可以先调用/v1/reference-data/airlines端点验证代码是否在API支持范围内:

    curl -X GET "https://test.api.amadeus.com/v1/reference-data/airlines?keyword=AF" -H "Authorization: Bearer [access_token]"
    

    如果返回空结果,说明该航司在测试环境未开放。

  • 修正请求参数的传递方式
    避免直接在URL拼接参数时出现隐形字符或编码问题,改用--data-urlencode传递参数:

    curl -X GET "https://test.api.amadeus.com/v2/reference-data/urls/checkin-links" -H "Authorization: Bearer [access_token]" --data-urlencode "airline=AF"
    

    或者手动输入完整URL,确保问号后只有airline=AF,没有多余空格或符号。

  • 检查API权限与端点版本
    登录Amadeus开发者后台,确认你的API密钥已开通v2/reference-data/urls/checkin-links端点的访问权限。另外,确认没有误用v1版本的端点(v1的参数规则可能不同)。

  • 验证access_token的实际有效性
    用当前token调用一个通用测试端点(比如城市查询),确认token未过期且权限正常:

    curl -X GET "https://test.api.amadeus.com/v1/reference-data/locations/cities?keyword=PAR" -H "Authorization: Bearer [access_token]"
    

    如果这个请求也失败,说明token本身有问题,需要重新获取。

  • 补充必要的请求头
    部分API要求显式指定Content-Type,尝试添加该头:

    curl -X GET "https://test.api.amadeus.com/v2/reference-data/urls/checkin-links?airline=AF" -H "Authorization: Bearer [access_token]" -H "Content-Type: application/json"
    

内容的提问来源于stack exchange,提问作者SDH

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 03:22:50