根据要求发送 dateTimeRange 航班过滤器时出错

Error sending dateTimeRange flight filters on request

我正在发送带有 dateTimeRange 过滤器的 POST 请求,以获取特定时间范围内的航班报价。

当我使用 departureDateTimeRange 或 arrivalDateTimeRange 时,响应工作正常并返回按我定义的 departure/arrival 时间范围过滤的航班

{
"currencyCode": "EUR",
"originDestinations": [
    {
        "id": "1",
        "originLocationCode": "OPO",
        "destinationLocationCode": "FNC",
        "arrivalDateTimeRange": {
            "date": "2020-07-23",
            "time": "21:00:00",
            "timeWindow": "2H",
            "dateWindow": "P1D"
        }
    },
    {
        "id": "2",
        "originLocationCode": "FNC",
        "destinationLocationCode": "OPO",
        "departureDateTimeRange": {
            "date": "2020-07-24",
            "time": "08:00:00",
            "timeWindow": "1H",
            "dateWindow": "P1D"
        }
    }
],
"travelers": [
    {
        "id": "1",
        "travelerType": "ADULT"
    }
],
"sources": [
    "GDS"
],
"searchCriteria": {
    "flightFilters": {
        "cabinRestrictions": [
            {
                "cabin": "ECONOMY",
                "coverage": "ALL_SEGMENTS",
                "originDestinationIds": [
                    "1",
                    "2"
                ]
            }
        ],
        "connectionRestriction": {
            "maxNumberOfConnections": 2
        }
    },
    "pricingOptions": {
        "includedCheckedBagsOnly": true
    }
}

}

但我想完全过滤出发时间和到达时间...假设我想在 07:00h 和 09:00h 之间出发,并在 08:00h 之间到达和 09:00h,在 1 小时的飞行中。

{
"currencyCode": "EUR",
"originDestinations": [
    {
        "id": "1",
        "originLocationCode": "OPO",
        "destinationLocationCode": "LIS",
        "departureDateTimeRange": {
            "date": "2020-07-23",
            "time": "08:00:00",
            "timeWindow": "1H",
            "dateWindow": "P1D"
        },
        "arrivalDateTimeRange": {
            "date": "2020-07-23",
            "time": "09:00:00",
            "timeWindow": "1H",
            "dateWindow": "P1D"
        }
    },
    {
        "id": "2",
        "originLocationCode": "LIS",
        "destinationLocationCode": "OPO",
        "departureDateTimeRange": {
            "date": "2020-07-24",
            "time": "08:00:00",
            "timeWindow": "1H",
            "dateWindow": "P1D"
        },
        "arrivalDateTimeRange": {
            "date": "2020-07-24",
            "time": "09:00:00",
            "timeWindow": "1H",
            "dateWindow": "P1D"
        }
    }
],
"travelers": [
    {
        "id": "1",
        "travelerType": "ADULT"
    }
],
"sources": [
    "GDS"
],
"searchCriteria": {
    "flightFilters": {
        "cabinRestrictions": [
            {
                "cabin": "ECONOMY",
                "coverage": "ALL_SEGMENTS",
                "originDestinationIds": [
                    "1",
                    "2"
                ]
            }
        ],
        "connectionRestriction": {
            "maxNumberOfConnections": 2
        }
    },
    "pricingOptions": {
        "includedCheckedBagsOnly": true
    }
}

响应错误:

"errors": [
{
  "code": 2668,
  "title": "PARAMETER COMBINATION INVALID/RESTRICTED",
  "detail": "departureDateTimeRange and arrivalDateTimeRange are not compatible",
  "source": {
    "pointer": "/originDestinations[0]"
  },
  "status": 400
},
{
  "code": 2668,
  "title": "PARAMETER COMBINATION INVALID/RESTRICTED",
  "detail": "departureDateTimeRange and arrivalDateTimeRange are not compatible",
  "source": {
    "pointer": "/originDestinations[1]"
  },
  "status": 400
}

]

这实际上是否意味着我根本无法在同一个请求中组合 departureTimeRange 和 arrivalDateTimeRange,或者我在请求详细信息中做了一些事情wrong/missing?

谢谢!

你没有做错任何事。航班优惠搜索 API 不允许您同时使用 departureTimeRangearrivalDateTimeRange 进行搜索,您可以使用一个或另一个功能。背后的逻辑是return所有可用的航班要么在特定时间起飞,要么在特定时间到达目的地。

如果您想检查出发时间到达时间,您需要使用departureTimeRange并在响应中过滤到达时间。

如果您想获得在特定时间 起飞或 在特定时间到达的航班列表,则需要调用 API 两次,使用一次 departureTimeRange 一次 arrivalDateTimeRange.