Amadeus How to get the flight details for a particular time duration? - amadeus

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"
}
}
]
}

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"
]
}
}
}
}

Related

Sample code for WhatsApp interactive template message

Does anyone have a sample code for WhatsApp interactive template message?
I am trying to trigger an API from postman but getting the below error:
{
"meta": {
"api_status": "stable",
"version": "2.37.1"
},
"errors": [
{
"code": 2012,
"title": "Parameter format does not match format in the created template",
"details": "header: Format mismatch, expected Video, received Unknown",
"href": "https://developers.facebook.com/docs/whatsapp/faq#faq_1612022582274564"
}
]
}
Here is what I added in the body:
{
"to": "91NUMBER",
"type": "template",
"template": {
"namespace": "NAMESPACE_ID",
"language": {
"policy": "deterministic",
"code": "en"
},
"name": "TEMPLATE_NAME",
"components": [
{
"type": "header",
"parameters": [
{
"type": "video",
"video": {
"link": "https://res.cloudinary.com/MY_VIDEO_LINK"
}
}
],
"type": "button",
"sub_type": "url",
"index": "0",
"parameters": [
{
"type": "text",
"text": "9rwnB8RbYmPF5t2Mn09x4h"
}
]
}
]
}
}
Any sort of help would be appreciated.
PS: I'm still new to this.
Use the below code maybe it works
{
"to": "91NUMBER",
"type": "template",
"template": {
"namespace": "NAMESPACE_ID",
"language": {
"policy": "deterministic",
"code": "en"
},
"name": "TEMPLATE_NAME",
"components": [
{
"type": "header",
"parameters": [
{
"type": "video",
"video": {
"link": "https://res.cloudinary.com/MY_VIDEO_LINK"
}
}
]
},
{
"type": "button",
"sub_type": "url",
"index": "0",
"parameters": [
{
"type": "text",
"text": "9rwnB8RbYmPF5t2Mn09x4h"
}
]
}
]
}
}

Amadeus Flight Offers Different Prices

We're using flight offers search api and ready to move to prod. But when we search flights with ECONOMY class the prices are not even close to "amadeus.net" search engine results or TK (Turkish Airlines) web site prices. If we use BUSINESS class as a parameter the api results are closer to real prices. How can we solve this issue?
The sample query is: (IST - CGN 25th May ECONOMY and TK Opearated flight departures 16:05 )
/v2/shopping/flight-offers?originLocationCode=IST&destinationLocationCode=CGN&departureDate=2021-05-25&adults=1&travelClass=ECONOMY&includedAirlineCodes=TK&nonStop=true&max=250
The api result is: €206.55
TK Web Site: €121
Amadeus.net €103
Detailed API result:
{
"meta": {
"count": 2,
"links": {
"self": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=IST&destinationLocationCode=CGN&departureDate=2021-05-25&adults=1&travelClass=ECONOMY&includedAirlineCodes=TK&nonStop=true&max=250"
}
},
"data": [
{
"type": "flight-offer",
"id": "2",
"source": "GDS",
"instantTicketingRequired": false,
"nonHomogeneous": false,
"oneWay": false,
"lastTicketingDate": "2021-05-25",
"numberOfBookableSeats": 9,
"itineraries": [
{
"duration": "PT3H20M",
"segments": [
{
"departure": {
"iataCode": "IST",
"at": "2021-05-25T16:05:00"
},
"arrival": {
"iataCode": "CGN",
"terminal": "2",
"at": "2021-05-25T18:25:00"
},
"carrierCode": "TK",
"number": "1675",
"aircraft": {
"code": "321"
},
"operating": {
"carrierCode": "TK"
},
"duration": "PT3H20M",
"id": "2",
"numberOfStops": 0,
"blacklistedInEU": false
}
]
}
],
"price": {
"currency": "EUR",
"total": "206.55",
"base": "134.00",
"fees": [
{
"amount": "0.00",
"type": "SUPPLIER"
},
{
"amount": "0.00",
"type": "TICKETING"
}
],
"grandTotal": "206.55"
},
"pricingOptions": {
"fareType": [
"PUBLISHED"
],
"includedCheckedBagsOnly": true
},
"validatingAirlineCodes": [
"TK"
],
"travelerPricings": [
{
"travelerId": "1",
"fareOption": "STANDARD",
"travelerType": "ADULT",
"price": {
"currency": "EUR",
"total": "206.55",
"base": "134.00"
},
"fareDetailsBySegment": [
{
"segmentId": "2",
"cabin": "ECONOMY",
"fareBasis": "QT2PXOW",
"class": "Q",
"includedCheckedBags": {
"weight": 30,
"weightUnit": "KG"
}
}
]
}
]
}
],
"dictionaries": {
"locations": {
"SAW": {
"cityCode": "IST",
"countryCode": "TR"
},
"CGN": {
"cityCode": "CGN",
"countryCode": "DE"
},
"IST": {
"cityCode": "IST",
"countryCode": "TR"
}
},
"aircraft": {
"321": "AIRBUS A321",
"738": "BOEING 737-800"
},
"currencies": {
"EUR": "EURO"
},
"carriers": {
"TK": "TURKISH AIRLINES"
}
}
}
Thanks in advance
There are two reasons why you see different prices:
The Self-Service APIs return published airfares coming from the GDS and not any negotiated ones. That means the flights returned by the APIs can be more expensive than the ones you find in OTAs or airline websites.
In the test environment that you are using, you get access to cached flight data which might be different from the live prices.

extra bag information is missing in the flight offer price response

I'm testing self-service APIs. I wonder if this is a bug:
I make a search request, and the response contains the extra bag information in the flight-offer/price/additionalServices
Then I make the offer price request by adding include=bags parameter in the path of Flight Offers Price API.
However there is no any bags information in the response, neither in the offer/price/additionalServices, nor in the included/.
I still try to create order by adding the extra bag. So I use the extra bag information that I got at step 1 (search response). And the order is created successfully.
It seems that the extra bag information is missing in step 2 (response of flight offer price), is it a bug?
Here is an example of my test to reproduce the issue:
search request
{
"currencyCode": "EUR",
"originDestinations": [
{
"id": "1",
"originLocationCode": "PAR",
"destinationLocationCode": "NYC",
"departureDateTimeRange": {
"date": "2020-08-20",
"time": "10:00:00"
}
}
],
"travelers": [
{
"id": "1",
"travelerType": "ADULT"
}
],
"sources": [
"GDS"
],
"searchCriteria": {
"maxFlightOffers": 3
}
}
Then I select the second offer in the response to make a offer price request using include=bags parameter
{
"type": "flight-offer",
"id": "2",
"source": "GDS",
"instantTicketingRequired": false,
"nonHomogeneous": false,
"oneWay": false,
"lastTicketingDate": "2020-08-13",
"numberOfBookableSeats": 8,
"itineraries": [
{
"duration": "PT8H15M",
"segments": [
{
"departure": {
"iataCode": "ORY",
"terminal": "4",
"at": "2020-08-20T19:45:00"
},
"arrival": {
"iataCode": "EWR",
"terminal": "B",
"at": "2020-08-20T22:00:00"
},
"carrierCode": "TX",
"number": "6720",
"aircraft": {
"code": "359"
},
"operating": {
"carrierCode": "BF"
},
"duration": "PT8H15M",
"id": "3",
"numberOfStops": 0,
"blacklistedInEU": false
}
]
}
],
"price": {
"currency": "EUR",
"total": "149.44",
"base": "41.00",
"fees": [
{
"amount": "0.00",
"type": "SUPPLIER"
},
{
"amount": "0.00",
"type": "TICKETING"
}
],
"grandTotal": "149.44",
"additionalServices": [
{
"amount": "70.00",
"type": "CHECKED_BAGS"
}
]
},
"pricingOptions": {
"fareType": [
"PUBLISHED"
],
"includedCheckedBagsOnly": false
},
"validatingAirlineCodes": [
"TX"
],
"travelerPricings": [
{
"travelerId": "1",
"fareOption": "STANDARD",
"travelerType": "ADULT",
"price": {
"currency": "EUR",
"total": "149.44",
"base": "41.00"
},
"fareDetailsBySegment": [
{
"segmentId": "3",
"cabin": "ECONOMY",
"fareBasis": "ULBCOWFR",
"brandedFare": "EBASIC",
"class": "U",
"includedCheckedBags": {
"quantity": 0
}
}
]
}
]
}
There is no extra bag in the response.
Thanks

Error sending dateTimeRange flight filters on request

I am sending a POST request with dateTimeRange filters to get flight offers on a particular time range.
When I use the departureDateTimeRange OR arrivalDateTimeRange, the response is working fine and returning the flights filtered by the departure/arrival time ranges that I have defined
{
"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
}
}
}
But I'd like to filter the Departure time AND the Arrival time altogether... let's pretend I want to departure between 07:00h and 09:00h, and arrive between 08:00h and 09:00h, in a 1 hour flight.
{
"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
}
}
The response is an error:
"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
}
]
Does this actually mean that I cannot, at all, combine departureTimeRange and arrivalDateTimeRange on the same request, or am I doing something wrong/missing something here on the request details?
Thank you!
You are not doing anything wrong. The Flight Offers Search API doesn't allow you to search by using both the departureTimeRange AND the arrivalDateTimeRange, you can use one or the other feature. The logic behind is to return all the flights available to either leave at a specific time or to arrive at the destination at a specific time.
If you want to check the departureTime AND the arrivalTime you need to use departureTimeRange and filter in the response the arrivalTime.
If you want to have the list of flights that either leave at a specific time OR arrive at a specific time then you need to call the API twice using once departureTimeRange and the other one arrivalDateTimeRange.

Can't use includedCheckedBags attribute in Amadeus Flight Offers API

When I try to create a request in the test environment that returns tickets with checked bags only I receive the following error:
{
"errors": [
{
"code": 2668,
"title": "PARAMETER COMBINATION INVALID/RESTRICTED",
"detail": "Pricing option includedCheckedBags is true but officeId is not allowed",
"status": 400
}
]
}
I'm trying this from the API explorer in the test environment.
This is the full body of my request:
{
"currencyCode": "EUR",
"originDestinations": [
{
"id": "1",
"originLocationCode": "MAD",
"destinationLocationCode": "NYC",
"departureDateTimeRange": {
"date": "2019-09-01",
"time": "10:00:00",
"timeWindow" : "6H"
}
},
{
"id": "2",
"originLocationCode": "NYC",
"destinationLocationCode": "MIA",
"departureDateTimeRange": {
"date": "2019-09-03",
"time": "17:00:00",
"timeWindow": "2H"
}
},
{
"id": "3",
"originLocationCode": "MCO",
"destinationLocationCode": "MAD",
"departureDateTimeRange": {
"date": "2019-09-07",
"time": "17:00:00",
"timeWindow": "6H"
}
}
],
"travelers": [
{
"id": "1",
"travelerType": "ADULT",
"fareOptions": [
"STANDARD"
]
}
],
"sources": [
"GDS", "PYTON"
],
"searchCriteria": {
"maxFlightOffers": 50,
"pricingOptions" : {
"includedCheckedBagsOnly" : true
},
"flightFilters": {
"connectionRestriction":
{
"airportChangeAllowed" : false,
"maxNumberOfConnections" : 1
},
"cabinRestrictions":
[{
"cabin" : "BUSINESS",
"coverage" : "MOST_SEGMENTS",
"originDestinationIds" : ["1", "2", "3"]
}]
}
}
}
I would expect this to work, since it is documented in the API page, but the error message is not helpful at all.
Everything has been fixed in the test and in the production environment.