此內容尚不提供此語言版本

Flight Search

The Flight Listings API allows you to search Expedia flight inventory by date, origin, destination, and other parameters to return a listing of available flights.

For more information about the Listings API, see Listings API documentation.

1. Build the request object using the classes defined in the SDK

For One Way

GetFlightListingsOperationParams listingsOperationParams = GetFlightListingsOperationParams.builder()
        .partnerTransactionID("txn-123-4")
        .segment1Origin("LAS") // segment1.origin
        .segment1Destination("FLL") // segment1.destination
        .segment1DepartureDate(LocalDate.parse("2025-09-01")) // segment1.departureDate
        .adult(1) // adult
        .senior(1) // senior
        .childrenAges(Arrays.asList(4, 5)) // childrenages
        .build();


GetFlightListingsOperation flightListingsOperations =
        new GetFlightListingsOperation(listingsOperationParams);

For Round Trip

GetFlightListingsOperationParams listingsOperationParams = GetFlightListingsOperationParams.builder()
        .partnerTransactionID("txn-123-4")
        .segment1Origin("LAS") // segment1.origin
        .segment1Destination("FLL") // segment1.destination
        .segment2Origin("FLL") // segment2.origin
        .segment2Destination("LAS")// segment2.destination
        .segment1DepartureDate(LocalDate.parse("2025-09-01")) // segment1.departureDate
        .segment2DepartureDate(LocalDate.parse("2025-09-11")) // segment2.departureDate
        .adult(1) // adult
        .senior(1) // senior
        .childrenAges(Arrays.asList(4, 5)) // childrenages
        .build();


GetFlightListingsOperation flightListingsOperations =
        new GetFlightListingsOperation(listingsOperationParams);

For Multi-City

GetFlightListingsOperationParams listingsOperationParams = GetFlightListingsOperationParams.builder()
        .partnerTransactionID("txn-123-4")
        .segment1Origin("LAS") // segment1.origin
        .segment1Destination("LAX") // segment1.destination
        .segment2Origin("FLL") // segment2.origin
        .segment2Destination("LAS")// segment2.destination
        .segment1DepartureDate(LocalDate.parse("2025-09-01")) // segment1.departureDate
        .segment2DepartureDate(LocalDate.parse("2025-09-11")) // segment2.departureDate
        .adult(1) // adult
        .senior(1) // senior
        .childrenAges(Arrays.asList(4, 5)) // childrenages
        .build();

GetFlightListingsOperation flightListingsOperations =
        new GetFlightListingsOperation(listingsOperationParams);

2. Make the API call using service client.

Response<FlightSearchResponse> flightlistingsResponse = 
        xapClient.execute(flightListingsOperations);
這個頁面有幫助嗎?
我們能如何改善內容?
感謝您協助我們進行改善!