A Java client for the SkyScanner REST API
Current roadmap:
-
Support for the Flights Live Pricing API
-
Support for the Hotels Price List and Hotels Details service
-
Support for the Car Hire Live Pricing
Dependencies:
- Gson
- Retrofit 2
Simple example:
SkyScannerClient client = new SkyScannerClient("Your SkyScanner API key");
// Create the session object with the request data
SessionRequest sessionRequest = SessionRequest.SessionRequestBuilder.aSessionRequest()
.withAdults(1)
.withDestinationPlace("MAD")
.withInboundDate("2016-12-20")
.withLocale("pt-PT")
.withLocationSchema(LocationSchema.iata)
.withOriginPlace("OPO")
.withOutboundDate("2016-12-15")
.withCurrency("EUR")
.withCountry("PT")
.build();
// Create session
Response session = client.createSession(sessionRequest);
// Get the polling session URL from the response headers
String pollSessionUrl = session.headers().get("location");
// Get the polling session id from the pollSessionUrl
// Start polling
Response<PollingResponse> response = client.pollSession(sessionId);
This is a work in progress.
Pull requests are welcome.