此内容尚无该语言版本

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);
您觉得这个页面有用吗?
我们该如何改进这些内容?
感谢您帮助我们改进!