So who doesn’t love cheap flights? (Probably people who don’t like to fly, but I digress.) Usually, the problem with this is that you still need to go search for the flights manually which is a real pain, or the websites that offer something like this have very rigid boundaries in which you can search.

If you do enjoy cheap “get out of town” flights, this post is for you! Using VMware vRealize Orchestrator and the same engine that Google Flights uses, you can set your criteria to find your cheap flight! Let me know what you think!

Flight Search API Documentation

Date Parsing Code:

var date = new Date();
date.setMonth(date.getMonth() + 4); // How many months forward to check

var dayFriday = getNextDayOfWeek(date, “5”); // Getting Next Friday
var dateFriday = dayFriday.getFullYear() + “-” + minTwoDigits(dayFriday.getMonth()+1) + “-” + minTwoDigits(dayFriday.getDate());
var daySunday = getNextDayOfWeek(dayFriday, “7”); // Getting Following Sunday
var dateSunday = daySunday.getFullYear() + “-” + minTwoDigits(daySunday.getMonth()+1) + “-” + minTwoDigits(daySunday.getDate());

if(logOutput == true){
System.log(dateFriday);
System.log(dateSunday);
}

function getNextDayOfWeek(date, dayOfWeek) {
var resultDate = new Date(date.getTime());
resultDate.setDate(date.getDate() + (7 + dayOfWeek – date.getDay()) % 7);
return resultDate;
}

function minTwoDigits(n) {return (n < 10 ? ‘0’ : ”) + n;}