How To Use SkyScanner API in ASP.Net?

In this era of technology, we think that we can get everything on internet. But we forgot that if we don’t share then how will we/others get that. This happens with me as well few weeks ago! Well, I was given assignment of creating traveler page by using SkyScanner API. I thought that I will be able to do it easily by referring SkyScanner official API documentation but it was not so easy. I tried to find if anyone has shared any code snippet to consume SkyScanner API in ASP.Net but not much luck. Here is the official SkyScanner API documentation. https://support.business.skyscanner.net/hc/en-us/articles/210645649-Overview https://support.business.skyscanner.net/hc/en-us/articles/211308489-Flights-Live-Pricing So I researched and created traveler page by using SkyScanner API. I then thought let me share my research and code snippets with you in case if you are in the same boat. Below is the landing page where user can search for flight based on different criteria. User can search for either “Round Trip” or “One Way” trip as per choice.

I created one landing page named default.aspx from where user can search for flights. On clicking search button, user will be redirected to search result page name flight-search.aspx

Airport API:

 Airport API is used to auto suggest airport when user type in “To” and “From” textbox

SkyScanner Flight API:

Skyscanner API is used to pull flight details as per given input. You can study API at official documentation https://support.business.skyscanner.net/hc/en-us/articles/211308489-Flights-Live-Pricingfor further details.

Search Result Page:

This will call Skyscanner API and will display result like this

Search Result Filters:

I have also implemented filters functionality which you can explore by looking into code and integrate it as per business requirement. Below screen shows all NON-STOP flights.

Below screen shows all fly-dubai flight as per filter. Clicking on “Book” button will redirect to actual airlines website to book the ticket.

How To Test SkyScanner API

Option-1: Use Postman

You can use any tool to test SkyScanner API, but my favorite one it “Postman” which is getting used by industry. 1)  Install Postman or any other tool as per your choice to test SkyScanner API

2) Send GET request and read “Location” field in HEADER from response. var URL = “http://partners.api.skyscanner.net/apiservices/pricing/uk1/v1.0/” + sessionKey + “?apiKey=” + “prtl6749387986743898559646983194”;

3) Now send POST request with all input values. poststring = String.Format(“apiKey={0}&country={1}&currency={2}&locale={3}&originplace={4}&destinationplace={5}&outbounddate={6}&adults={7}”, “prtl6749387986743898559646983194”, “AE”, “AED”, “en-US”, fromAirPort, ToAirPort, oneWayDepartDate.ToString(“yyyy-MM-dd”), passengers);

Option 2: Use SkyScanner Test Harness page:

SkyScanner has provided on test harness page where you can test your API key with all search paratmters to check flight search results.

This test harness page can be found at:

http://business.skyscanner.net/portal/en-GB/Documentation/FlightsLivePricingQuickStart

If you are looking for a complete SkyScanner API project or more details then get in touch with me by posting comment or send an email.

Hope this post will help you get started with SkyScanner API in .NET !

5 Responses to “How To Use SkyScanner API in ASP.Net?”
  1. Vishi January 1, 2017
  2. Nilesh Thakkar January 2, 2017
  3. Vishi January 3, 2017
  4. Unknown July 4, 2017
  5. for ict 99 December 6, 2017

Leave a Reply