Tuesday, 29 November 2016

Sitecore Language Checklist Report Tool

Smart programmer hates manual and time consuming task, hence they are always looking for automating those manual boring task.

In-fact that's why you are programmer - to automate such stuff and help your team.

Recently I found that my content team member was asked by client to prepare a report to show all available languages for particular set of items. For example: Prepare a report of all available languages for articles, events, news.

Just imagine that how much time will it take to go and check whether particular language is available or not from 18 languages (yes, we have 18 languages configured for our Sitecore website) and hundreds of articles, events and news.

In order to help my content team to automate this process, I thought that it's good idea to create a Language Report Tool which will show all available languages for particular set of Sitecore items.

This is how report look like. Basically this tool is a kind of Sitecore Language Checklist for all the sub-items of given page.

0 indicates no language version available for that item.
1 indicates  language version available for that item.

You can click on download button to generate report of this language statistics. It will download a complete report in XLS format.

Click here to download Sitecore Package for this tool/utility from Sitecore Marketplace. You simply need to install this package from Sitecore desktop editor, it will deploy the page under Sitecore - Admin folder.

For security reasons, you should place this tool/utility under Sitecore --> Admin folder. Although this page is intelligent enough to  redirect you to login page, if your are not admin and try to access this page.

Hope this will save your lots of time if your client has such crazy requirement :)

Thursday, 17 November 2016

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.

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:

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 !