Search code examples
amadeus

I keep getting numberOfstops in the flightOffer API response as 0 even when there is a stop


I am new to the Amadeus API and generally the flight business as a whole but I have set up a dev account with Amadeus and I am on a test Plan at the moment. I made a call to the flightOffers API thus;

await Amadeus.shopping.flightOffersSearch.get({myRequestPayload})

I got a successful response with 2 offers. However, my confusion is around the field numberOfStops which is 0 in the response. Please see the segments below as copied from the response I got;

"segments": [
                        {
                            "departure": {
                                "iataCode": "SYD",
                                "terminal": "1",
                                "at": "2022-11-01T11:35:00"
                            },
                            "arrival": {
                                "iataCode": "MNL",
                                "terminal": "2",
                                "at": "2022-11-01T16:50:00"
                            },
                            "carrierCode": "PR",
                            "number": "212",
                            "aircraft": {
                                "code": "333"
                            },
                            "operating": {
                                "carrierCode": "PR"
                            },
                            "duration": "PT8H15M",
                            "id": "1",
                            "numberOfStops": 0,
                            "blacklistedInEU": false
                        },
                        {
                            "departure": {
                                "iataCode": "MNL",
                                "terminal": "1",
                                "at": "2022-11-01T19:20:00"
                            },
                            "arrival": {
                                "iataCode": "BKK",
                                "at": "2022-11-01T21:50:00"
                            },
                            "carrierCode": "PR",
                            "number": "732",
                            "aircraft": {
                                "code": "321"
                            },
                            "operating": {
                                "carrierCode": "PR"
                            },
                            "duration": "PT3H30M",
                            "id": "2",
                            "numberOfStops": 0,
                            "blacklistedInEU": false
                        }
                    ]

From my understanding from what I have read recently about Direct, NonStops flights, this flight is definitely not NonStop since there is a stop at MNL. Hence I think the numberOfStops should be say 2 since:

  1. It is a round trip
  2. For each trip, it stops at MNL

I am just guessing this Number based on what is apparent to me. Please correct me If I am wrong.

  1. I need to understand why numberOfStops = 0 and not > 0.
  2. Is there a way to determine the numberOfStops without relying on the value returned?

Thanks and I anticipate any help soonest.


Solution

  • numberOfStops is the number of stops planned on the segment for technical or operation purpose i.e. refueling. The API will rarely return with a value but when it does it means that a segment is flown with the same plane. This represents a scheduled stop for technical/operational purposes like for example to refuel. You can check the description of the parameter in the specification file.

    The API does not directly return the number of flight connections. This will need to be checked by looking at the segment size. If a segment has 2 items it means it has 2 flights. In the case of a round trip, then itineraries[0] contains the segments of the way to go back, and itineraries[1] contains the segments (flights) of the way back.