snufka / LastMinuteTrip

1 stars 2 forks source link

analyze amadeus API response, and get an object to be reused for frontend #18

Open snufka opened 4 years ago

saul89 commented 4 years ago

{ "meta": { "count": 10, "links": { "self": "https://test.api.amadeus.com/v2/shopping/flight-offers?originLocationCode=BER&destinationLocationCode=TLV&departureDate=2019-11-01&adults=1&nonStop=false&max=10" } }, "data": [ { "type": "flight-offer", "id": "1", "source": "GDS", "instantTicketingRequired": false, "nonHomogeneous": false, "oneWay": false, "lastTicketingDate": "2019-10-31", "numberOfBookableSeats": 9, "itineraries": [ { "duration": "PT32H5M", "segments": [ { "departure": { "iataCode": "TXL", "at": "2019-11-01T12:25:00" }, "arrival": { "iataCode": "LIS", "terminal": "1", "at": "2019-11-01T15:00:00" }, "carrierCode": "TP", "number": "537", "aircraft": { "code": "32Q" }, "operating": { "carrierCode": "TP" }, "duration": "PT3H35M", "id": "3", "numberOfStops": 0, "blacklistedInEU": false }, { "departure": { "iataCode": "LIS", "terminal": "1", "at": "2019-11-02T14:20:00" }, "arrival": { "iataCode": "TLV", "terminal": "3", "at": "2019-11-02T21:30:00" }, "carrierCode": "TP", "number": "1603", "aircraft": { "code": "32Q" }, "operating": { "carrierCode": "TP" }, "duration": "PT5H10M", "id": "4", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "143.17", "base": "5.00", "fees": [ { "amount": "0.00", "type": "SUPPLIER" }, { "amount": "0.00", "type": "TICKETING" } ], "grandTotal": "143.17", "additionalServices": [ { "amount": "70.00", "type": "CHECKED_BAGS" } ] }, "pricingOptions": { "fareType": [ "PUBLISHED" ], "includedCheckedBagsOnly": false }, "validatingAirlineCodes": [ "TP" ], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "143.17", "base": "5.00" }, "fareDetailsBySegment": [ { "segmentId": "3", "cabin": "ECONOMY", "fareBasis": "ODEDSI05", "brandedFare": "DISCOUNT", "class": "O", "includedCheckedBags": { "quantity": 0 } }, { "segmentId": "4", "cabin": "ECONOMY", "fareBasis": "ODEDSI05", "brandedFare": "DISCOUNT", "class": "O", "includedCheckedBags": { "quantity": 0 } } ] } ] }, { "type": "flight-offer", "id": "2", "source": "GDS", "instantTicketingRequired": false, "nonHomogeneous": false, "oneWay": false, "lastTicketingDate": "2019-10-30", "numberOfBookableSeats": 9, "itineraries": [ { "duration": "PT6H25M", "segments": [ { "departure": { "iataCode": "SXF", "at": "2019-11-01T13:55:00" }, "arrival": { "iataCode": "SAW", "at": "2019-11-01T18:45:00" }, "carrierCode": "PC", "number": "980", "aircraft": { "code": "320" }, "operating": { "carrierCode": "PC" }, "duration": "PT2H50M", "id": "13", "numberOfStops": 0, "blacklistedInEU": false }, { "departure": { "iataCode": "SAW", "at": "2019-11-01T20:20:00" }, "arrival": { "iataCode": "TLV", "at": "2019-11-01T21:20:00" }, "carrierCode": "PC", "number": "785", "aircraft": { "code": "320" }, "operating": { "carrierCode": "PC" }, "duration": "PT2H", "id": "14", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "146.71", "base": "53.00", "fees": [ { "amount": "0.00", "type": "SUPPLIER" }, { "amount": "0.00", "type": "TICKETING" } ], "grandTotal": "146.71" }, "pricingOptions": { "fareType": [ "PUBLISHED" ], "includedCheckedBagsOnly": true }, "validatingAirlineCodes": [ "PC" ], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "146.71", "base": "53.00" }, "fareDetailsBySegment": [ { "segmentId": "13", "cabin": "ECONOMY", "fareBasis": "IOWBYD1W", "class": "I", "includedCheckedBags": { "weight": 20, "weightUnit": "KG" } }, { "segmentId": "14", "cabin": "ECONOMY", "fareBasis": "IOWBYD1W", "class": "I", "includedCheckedBags": { "weight": 20, "weightUnit": "KG" } } ] } ] }, { "type": "flight-offer", "id": "3", "source": "GDS", "instantTicketingRequired": false, "nonHomogeneous": false, "oneWay": false, "lastTicketingDate": "2019-10-30", "numberOfBookableSeats": 9, "itineraries": [ { "duration": "PT8H35M", "segments": [ { "departure": { "iataCode": "SXF", "at": "2019-11-01T11:45:00" }, "arrival": { "iataCode": "SAW", "at": "2019-11-01T16:35:00" }, "carrierCode": "PC", "number": "978", "aircraft": { "code": "320" }, "operating": { "carrierCode": "PC" }, "duration": "PT2H50M", "id": "17", "numberOfStops": 0, "blacklistedInEU": false }, { "departure": { "iataCode": "SAW", "at": "2019-11-01T20:20:00" }, "arrival": { "iataCode": "TLV", "at": "2019-11-01T21:20:00" }, "carrierCode": "PC", "number": "785", "aircraft": { "code": "320" }, "operating": { "carrierCode": "PC" }, "duration": "PT2H", "id": "18", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "146.71", "base": "53.00", "fees": [ { "amount": "0.00", "type": "SUPPLIER" }, { "amount": "0.00", "type": "TICKETING" } ], "grandTotal": "146.71" }, "pricingOptions": { "fareType": [ "PUBLISHED" ], "includedCheckedBagsOnly": true }, "validatingAirlineCodes": [ "PC" ], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "146.71", "base": "53.00" }, "fareDetailsBySegment": [ { "segmentId": "17", "cabin": "ECONOMY", "fareBasis": "IOWBYD1W", "class": "I", "includedCheckedBags": { "weight": 20, "weightUnit": "KG" } }, { "segmentId": "18", "cabin": "ECONOMY", "fareBasis": "IOWBYD1W", "class": "I", "includedCheckedBags": { "weight": 20, "weightUnit": "KG" } } ] } ] }, { "type": "flight-offer", "id": "4", "source": "GDS", "instantTicketingRequired": false, "nonHomogeneous": false, "oneWay": false, "lastTicketingDate": "2019-10-30", "numberOfBookableSeats": 9, "itineraries": [ { "duration": "PT9H15M", "segments": [ { "departure": { "iataCode": "SXF", "at": "2019-11-01T13:55:00" }, "arrival": { "iataCode": "SAW", "at": "2019-11-01T18:45:00" }, "carrierCode": "PC", "number": "980", "aircraft": { "code": "320" }, "operating": { "carrierCode": "PC" }, "duration": "PT2H50M", "id": "9", "numberOfStops": 0, "blacklistedInEU": false }, { "departure": { "iataCode": "SAW", "at": "2019-11-01T23:10:00" }, "arrival": { "iataCode": "TLV", "at": "2019-11-02T00:10:00" }, "carrierCode": "PC", "number": "779", "aircraft": { "code": "320" }, "operating": { "carrierCode": "PC" }, "duration": "PT2H", "id": "10", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "146.71", "base": "53.00", "fees": [ { "amount": "0.00", "type": "SUPPLIER" }, { "amount": "0.00", "type": "TICKETING" } ], "grandTotal": "146.71" }, "pricingOptions": { "fareType": [ "PUBLISHED" ], "includedCheckedBagsOnly": true }, "validatingAirlineCodes": [ "PC" ], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "146.71", "base": "53.00" }, "fareDetailsBySegment": [ { "segmentId": "9", "cabin": "ECONOMY", "fareBasis": "IOWBYD1W", "class": "I", "includedCheckedBags": { "weight": 20, "weightUnit": "KG" } }, { "segmentId": "10", "cabin": "ECONOMY", "fareBasis": "IOWBYD1W", "class": "I", "includedCheckedBags": { "weight": 20, "weightUnit": "KG" } } ] } ] }, { "type": "flight-offer", "id": "5", "source": "GDS", "instantTicketingRequired": false, "nonHomogeneous": false, "oneWay": false, "lastTicketingDate": "2019-10-30", "numberOfBookableSeats": 9, "itineraries": [ { "duration": "PT11H25M", "segments": [ { "departure": { "iataCode": "SXF", "at": "2019-11-01T11:45:00" }, "arrival": { "iataCode": "SAW", "at": "2019-11-01T16:35:00" }, "carrierCode": "PC", "number": "978", "aircraft": { "code": "320" }, "operating": { "carrierCode": "PC" }, "duration": "PT2H50M", "id": "15", "numberOfStops": 0, "blacklistedInEU": false }, { "departure": { "iataCode": "SAW", "at": "2019-11-01T23:10:00" }, "arrival": { "iataCode": "TLV", "at": "2019-11-02T00:10:00" }, "carrierCode": "PC", "number": "779", "aircraft": { "code": "320" }, "operating": { "carrierCode": "PC" }, "duration": "PT2H", "id": "16", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "146.71", "base": "53.00", "fees": [ { "amount": "0.00", "type": "SUPPLIER" }, { "amount": "0.00", "type": "TICKETING" } ], "grandTotal": "146.71" }, "pricingOptions": { "fareType": [ "PUBLISHED" ], "includedCheckedBagsOnly": true }, "validatingAirlineCodes": [ "PC" ], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "146.71", "base": "53.00" }, "fareDetailsBySegment": [ { "segmentId": "15", "cabin": "ECONOMY", "fareBasis": "IOWBYD1W", "class": "I", "includedCheckedBags": { "weight": 20, "weightUnit": "KG" } }, { "segmentId": "16", "cabin": "ECONOMY", "fareBasis": "IOWBYD1W", "class": "I", "includedCheckedBags": { "weight": 20, "weightUnit": "KG" } } ] } ] }, { "type": "flight-offer", "id": "6", "source": "GDS", "instantTicketingRequired": false, "nonHomogeneous": false, "oneWay": false, "lastTicketingDate": "2019-11-01", "numberOfBookableSeats": 9, "itineraries": [ { "duration": "PT7H", "segments": [ { "departure": { "iataCode": "TXL", "at": "2019-11-01T16:50:00" }, "arrival": { "iataCode": "ATH", "at": "2019-11-01T20:35:00" }, "carrierCode": "A3", "number": "823", "aircraft": { "code": "320" }, "operating": { "carrierCode": "A3" }, "duration": "PT2H45M", "id": "1", "numberOfStops": 0, "blacklistedInEU": false }, { "departure": { "iataCode": "ATH", "at": "2019-11-01T22:50:00" }, "arrival": { "iataCode": "TLV", "terminal": "3", "at": "2019-11-02T00:50:00" }, "carrierCode": "A3", "number": "928", "aircraft": { "code": "321" }, "operating": { "carrierCode": "A3" }, "duration": "PT2H", "id": "2", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "158.84", "base": "88.00", "fees": [ { "amount": "0.00", "type": "SUPPLIER" }, { "amount": "0.00", "type": "TICKETING" } ], "grandTotal": "158.84", "additionalServices": [ { "amount": "25.00", "type": "CHECKED_BAGS" } ] }, "pricingOptions": { "fareType": [ "PUBLISHED" ], "includedCheckedBagsOnly": false }, "validatingAirlineCodes": [ "A3" ], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "158.84", "base": "88.00" }, "fareDetailsBySegment": [ { "segmentId": "1", "cabin": "ECONOMY", "fareBasis": "KNOBAGC", "brandedFare": "GOLIGHT", "class": "K", "includedCheckedBags": { "quantity": 0 } }, { "segmentId": "2", "cabin": "ECONOMY", "fareBasis": "KNOBAGC", "brandedFare": "GOLIGHT", "class": "K", "includedCheckedBags": { "quantity": 0 } } ] } ] }, { "type": "flight-offer", "id": "7", "source": "GDS", "instantTicketingRequired": false, "nonHomogeneous": false, "oneWay": false, "lastTicketingDate": "2019-11-01", "numberOfBookableSeats": 5, "itineraries": [ { "duration": "PT25H10M", "segments": [ { "departure": { "iataCode": "TXL", "at": "2019-11-01T16:50:00" }, "arrival": { "iataCode": "ATH", "at": "2019-11-01T20:35:00" }, "carrierCode": "A3", "number": "823", "aircraft": { "code": "320" }, "operating": { "carrierCode": "A3" }, "duration": "PT2H45M", "id": "7", "numberOfStops": 0, "blacklistedInEU": false }, { "departure": { "iataCode": "ATH", "at": "2019-11-02T17:00:00" }, "arrival": { "iataCode": "TLV", "terminal": "3", "at": "2019-11-02T19:00:00" }, "carrierCode": "A3", "number": "924", "aircraft": { "code": "320" }, "operating": { "carrierCode": "A3" }, "duration": "PT2H", "id": "8", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "158.84", "base": "88.00", "fees": [ { "amount": "0.00", "type": "SUPPLIER" }, { "amount": "0.00", "type": "TICKETING" } ], "grandTotal": "158.84", "additionalServices": [ { "amount": "25.00", "type": "CHECKED_BAGS" } ] }, "pricingOptions": { "fareType": [ "PUBLISHED" ], "includedCheckedBagsOnly": false }, "validatingAirlineCodes": [ "A3" ], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "158.84", "base": "88.00" }, "fareDetailsBySegment": [ { "segmentId": "7", "cabin": "ECONOMY", "fareBasis": "KNOBAGC", "brandedFare": "GOLIGHT", "class": "K", "includedCheckedBags": { "quantity": 0 } }, { "segmentId": "8", "cabin": "ECONOMY", "fareBasis": "KNOBAGC", "brandedFare": "GOLIGHT", "class": "K", "includedCheckedBags": { "quantity": 0 } } ] } ] }, { "type": "flight-offer", "id": "8", "source": "GDS", "instantTicketingRequired": false, "nonHomogeneous": false, "oneWay": false, "lastTicketingDate": "2019-10-31", "numberOfBookableSeats": 7, "itineraries": [ { "duration": "PT9H50M", "segments": [ { "departure": { "iataCode": "SXF", "at": "2019-11-01T12:00:00" }, "arrival": { "iataCode": "SVO", "terminal": "D", "at": "2019-11-01T16:35:00" }, "carrierCode": "SU", "number": "2313", "aircraft": { "code": "320" }, "operating": { "carrierCode": "SU" }, "duration": "PT2H35M", "id": "19", "numberOfStops": 0, "blacklistedInEU": false }, { "departure": { "iataCode": "SVO", "terminal": "D", "at": "2019-11-01T19:30:00" }, "arrival": { "iataCode": "TLV", "terminal": "3", "at": "2019-11-01T22:50:00" }, "carrierCode": "SU", "number": "504", "aircraft": { "code": "332" }, "operating": { "carrierCode": "SU" }, "duration": "PT4H20M", "id": "20", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "180.45", "base": "25.00", "fees": [ { "amount": "0.00", "type": "SUPPLIER" }, { "amount": "0.00", "type": "TICKETING" } ], "grandTotal": "180.45" }, "pricingOptions": { "fareType": [ "PUBLISHED" ], "includedCheckedBagsOnly": false }, "validatingAirlineCodes": [ "SU" ], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "180.45", "base": "25.00" }, "fareDetailsBySegment": [ { "segmentId": "19", "cabin": "ECONOMY", "fareBasis": "RNO", "brandedFare": "NB", "class": "R", "includedCheckedBags": { "quantity": 0 } }, { "segmentId": "20", "cabin": "ECONOMY", "fareBasis": "RNO", "brandedFare": "NB", "class": "R", "includedCheckedBags": { "quantity": 0 } } ] } ] }, { "type": "flight-offer", "id": "9", "source": "GDS", "instantTicketingRequired": false, "nonHomogeneous": false, "oneWay": false, "lastTicketingDate": "2019-10-31", "numberOfBookableSeats": 7, "itineraries": [ { "duration": "PT10H10M", "segments": [ { "departure": { "iataCode": "SXF", "at": "2019-11-01T23:35:00" }, "arrival": { "iataCode": "SVO", "terminal": "D", "at": "2019-11-02T04:05:00" }, "carrierCode": "SU", "number": "2317", "aircraft": { "code": "32B" }, "operating": { "carrierCode": "SU" }, "duration": "PT2H30M", "id": "5", "numberOfStops": 0, "blacklistedInEU": false }, { "departure": { "iataCode": "SVO", "terminal": "D", "at": "2019-11-02T07:10:00" }, "arrival": { "iataCode": "TLV", "terminal": "3", "at": "2019-11-02T10:45:00" }, "carrierCode": "SU", "number": "506", "aircraft": { "code": "32B" }, "operating": { "carrierCode": "SU" }, "duration": "PT4H35M", "id": "6", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "180.45", "base": "25.00", "fees": [ { "amount": "0.00", "type": "SUPPLIER" }, { "amount": "0.00", "type": "TICKETING" } ], "grandTotal": "180.45" }, "pricingOptions": { "fareType": [ "PUBLISHED" ], "includedCheckedBagsOnly": false }, "validatingAirlineCodes": [ "SU" ], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "180.45", "base": "25.00" }, "fareDetailsBySegment": [ { "segmentId": "5", "cabin": "ECONOMY", "fareBasis": "RNO", "brandedFare": "NB", "class": "R", "includedCheckedBags": { "quantity": 0 } }, { "segmentId": "6", "cabin": "ECONOMY", "fareBasis": "RNO", "brandedFare": "NB", "class": "R", "includedCheckedBags": { "quantity": 0 } } ] } ] }, { "type": "flight-offer", "id": "10", "source": "GDS", "instantTicketingRequired": false, "nonHomogeneous": false, "oneWay": false, "lastTicketingDate": "2019-10-31", "numberOfBookableSeats": 7, "itineraries": [ { "duration": "PT11H15M", "segments": [ { "departure": { "iataCode": "SXF", "at": "2019-11-01T23:35:00" }, "arrival": { "iataCode": "SVO", "terminal": "D", "at": "2019-11-02T04:05:00" }, "carrierCode": "SU", "number": "2317", "aircraft": { "code": "32B" }, "operating": { "carrierCode": "SU" }, "duration": "PT2H30M", "id": "11", "numberOfStops": 0, "blacklistedInEU": false }, { "departure": { "iataCode": "SVO", "terminal": "D", "at": "2019-11-02T08:35:00" }, "arrival": { "iataCode": "TLV", "terminal": "3", "at": "2019-11-02T11:50:00" }, "carrierCode": "SU", "number": "502", "aircraft": { "code": "77W" }, "operating": { "carrierCode": "SU" }, "duration": "PT4H15M", "id": "12", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "180.45", "base": "25.00", "fees": [ { "amount": "0.00", "type": "SUPPLIER" }, { "amount": "0.00", "type": "TICKETING" } ], "grandTotal": "180.45" }, "pricingOptions": { "fareType": [ "PUBLISHED" ], "includedCheckedBagsOnly": false }, "validatingAirlineCodes": [ "SU" ], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "180.45", "base": "25.00" }, "fareDetailsBySegment": [ { "segmentId": "11", "cabin": "ECONOMY", "fareBasis": "RNO", "brandedFare": "NB", "class": "R", "includedCheckedBags": { "quantity": 0 } }, { "segmentId": "12", "cabin": "ECONOMY", "fareBasis": "RNO", "brandedFare": "NB", "class": "R", "includedCheckedBags": { "quantity": 0 } } ] } ] } ], "dictionaries": { "locations": { "SXF": { "cityCode": "BER", "countryCode": "DE" }, "ATH": { "cityCode": "ATH", "countryCode": "GR" }, "LIS": { "cityCode": "LIS", "countryCode": "PT" }, "SAW": { "cityCode": "IST", "countryCode": "TR" }, "TXL": { "cityCode": "BER", "countryCode": "DE" }, "SVO": { "cityCode": "MOW", "countryCode": "RU" }, "TLV": { "cityCode": "TLV", "countryCode": "IL" } } } }

saul89 commented 4 years ago

Hi guys, this is an example of the response (JSON Object) that we get from Amadeus.

snufka commented 4 years ago

thank! working on in now