0
votes

I am trying to explore Amadeus API.My use-case is to search for flight at a particular duration. I checked for Flight Offer search with below params but getting error.

Please suggest on how can i pass time along with date to get flight details along with price.

https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=BLR&destinationLocationCode=DEL&departureDate=2020-07-10T08:00:00Z&returnDate=2020-07-13T12:00:00Z&adults=1&currencyCode=INR

{
  "errors": [
    {
      "status": 400,
      "code": 477,
      "title": "INVALID FORMAT",
      "detail": "departureDate format is YYYY-MM-DD",
      "source": {
        "pointer": "departureDate",
        "example": "2030-12-31"
      }
    },
    {
      "status": 400,
      "code": 477,
      "title": "INVALID FORMAT",
      "detail": "returnDate format is YYYY-MM-DD",
      "source": {
        "pointer": "returnDate",
        "example": "2030-12-31"
      }
    }
  ]
}
1

1 Answers

0
votes

With the Flight Offers Price -> GET you cannot specify the duration, you can only search for a date (format YYYY-MM-DD). You will have to read the response to understand the duration.

You can give more details using the Flight Offers Search -> POST

for example:

{
  "currencyCode": "USD",
  "originDestinations": [
    {
      "id": "1",
      "originLocationCode": "RIO",
      "destinationLocationCode": "MAD",
      "departureDateTimeRange": {
        "date": "2020-08-01",
        "time": "10:00:00"
      }
    },
    {
      "id": "2",
      "originLocationCode": "MAD",
      "destinationLocationCode": "RIO",
      "departureDateTimeRange": {
        "date": "2020-08-05",
        "time": "17:00:00"
      }
    }
  ],
  "travelers": [
    {
      "id": "1",
      "travelerType": "ADULT"
    },
    {
      "id": "2",
      "travelerType": "CHILD"
    }
  ],
  "sources": [
    "GDS"
  ],
  "searchCriteria": {
    "maxFlightOffers": 2,
    "flightFilters": {
      "cabinRestrictions": [
        {
          "cabin": "BUSINESS",
          "coverage": "MOST_SEGMENTS",
          "originDestinationIds": [
            "1"
          ]
        }
      ],
      "carrierRestrictions": {
        "excludedCarrierCodes": [
          "AA",
          "TP",
          "AZ"
        ]
      }
    }
  }
}