Aviation API – Airline and Airport Webservices

The term API (Application programming interface) is not new, basically a defined access to a set of methods, subroutines and data-types made available by one component/service to be used/consumed by another component or application. You can think of API as the car manual and the library being the engine under the hood.

Since the early days of tinkering with the Windows DLL hell more than 20 years have passed, we have better tools and standards by now. In the space of native apps for Windows, Android and iOS we still work with libraries and SDK’s (still can be challenging when resolving dependencies and deployment).
In the world of web applications today we look mostly at RESTful Webservices responding in JSON or XML, a rather straight forward implementation, the only complexity depends on the authorization mode or the mapping of attributes. A lot of websites, portals, services or products expose their WS for usage by third parties, from Salesforce, Ebay, Amazon to Twitter and infinite more. While these mentioned samples operate independently or work as standalone services there is not much need for standardization of the payload, aka the structure of attributes, naming conventions etc. For others business domain there is a need of standardization of such, despite the availability of AIDX, AIDM and a few more data exchange models, there is no standard widely used in the (public) WS space in aviation.
I have to highlight in ACI ACRIS a Semantic Model is being actively developed and the Open API Shop exists as project as well.

I researched what webservices are currently offered to the public by airports and airlines, excluding the API’s of system vendors and travel platforms.
So far I found these webservices (last update 2018-07-06):

Airline

International Airline Group
British Airways, Iberia, Avios
https://developer.iairgroup.com/
Lufthansa https://developer.lufthansa.com/
Airfrance, KLM https://developer.airfranceklm.com/
Alaska Air
https://developer.alaskaair.com/
Transavia https://developer.transavia.com/
FlyDubai https://developer.flydubai.com/
Virgin Australia
https://developer.virginaustralia.com/
Ryanair https://developer.ryanair.com/
Turkish Airlines
https://developer.turkishairlines.com

Airports

Schiphol Airport
https://developer.schiphol.nl/
San Francisco Airport
https://www.flysfo.com/api
Frankfurt Airport
https://developer.fraport.de/
Svedavia Airports
https://apideveloper.swedavia.se/

Others

FAA US
https://app.swaggerhub.com/apis/FAA/ASWS/1.1.0
Flightaware
http://flightaware.com/commercial/flightxml

The usage terms and price models vary but basically all give some kind of developer access to evaluate the services and data at no cost.

To compare a few of the services using a flight status related call, omitting the authentication. The lack of standard, putting aside JSON response format and date format, is quite obvious. It might not be relevant in the space of individual apps to have the same response format, but if you want to combine data from various sources you have to handle the formats separately. Even the request format with the query parameter differs.

British Airways

https://api.ba.com/rest-v1/v1/flights;departureLocation=FRA;startTime=06:00;endTime=11:00

ba

Swedavia Airports

https://api.swedavia.se/flightinfo/v2/query?filter=airport eq ‘ARN’ and scheduled eq ‘180713’ and flightType eq ‘A’ and flightId eq ‘DY4572’

IMG122

Lufthansa

https://api.lufthansa.com/v1/operations/flightstatus/LH778/2018-07-13

IMG123

I also tried with RyanAir (still waiting for approval to get api key), Turkish Airlines (no flight status API), Schiphol (no webservice test available on the website).

Image: Creative Commons, Robert Yarnall Richie Photograph Collection, “Models with Oldsmobile Automobile, Lockheed 10B Electra, Delta Air Lines, 1940”

Advertisements

Hands-On Amazon Echo Dot and Alexa

Amazon Echo, the voice-controlled and hands-free device/speaker was already launched in the US in November 2014, now 2 years later the Echo, and the Echo Dot second generation, is available in Europe. In Germany it was soft-launched in late October on an invitation base at Euro 59.99, the bigger Echo at Euro 179.-.

Amazon Echo Dot

Amazon Echo Dot

Curious enough about having a glimpse into our household and workplace (?) future I requested one and got it delivered last week Friday. At the size of a hockey puck, the device contains 7 microphones, a simple loudspeaker, WLAN and Bluetooth connectivity. No battery, so the Echo must be connected to a USB power adapter at all times. I must admit, the idea of having a “spy” device with microphones permanently listening into my room brings up some privacy concerns, though Amazon claims only the keyword (Alexa, Echo or Amazon) is activating the device, it’s LED ring starts to turn blue, and the spoken commands get transferred to the Amazon cloud, using the Alexa Voice Recognition Service, on which Amazon supposedly spend a 100 million dollars.

Amazon Echo Dot

Amazon Echo Dot

Here a first hands-on experience resume:

Being an Amazon user with a Prime account and already a Kindle and a Fire HD tablet at home, the setup takes less than 5 minutes, inclusive of setting up a WLAN connection from the Alexa App to the device, preparing the WLAN access from the device to your AP and connecting it via Bluetooth to the home theater system. The device is woken up with the keyword or by pressing one of the four buttons on top of it, followed by your question or command.

It does not run a conversational model in the basic use cases, though the skill sets support sessions ! You raise a question or trigger a command, that’s it. It wont ask back (yet). It will respond with the right answer or execute what you have asked for, or respond it if it does not understand you, sometimes it wont do anything at all after activation other than showing the blue ring (maybe due to noisy environment). The basic services available are rather simple or move around the Amazon product landscape, most prominently playing music on demand from the Amazon Prime Music offerings, ordering products from Amazon or responding with the weather info or respond to simple Wikipedia style questions. The power of the device is unfolding with the skill-sets that allow third parties to offer services based on the Alexa services. This can be house-automation, ordering pizzas and other consumer services. Being a regional feature there are about 3,000 skills available in the US but only about 2 dozens in Germany at the time of writing.

My kids had a Sunday afternoon fun time to play with it and trying to fool with it, though at this stage it wears out pretty fast after hearing “I don’t understand your request” and similar responses if you leave its pre-programmed comfort zone (it is interesting to observe how kids approach such a device). Be aware of the Eliza Effect using a device with a synthetic voice and human-like response.

What makes it particularly interesting to me is the evaluation of a completely voice based service and the platforms extensibility through the Alex Skill Set and the API’s that Amazon provides. You find lots of information at the Amazon developer portal and you can even join the Mashup Contest.

In short, right now it is still a toy but with lots of opportunities to come up in the near future. I will look at the potential use cases in a aviation environment, both operational and as passenger and keep you posted.

Amazon Echo Dot

Amazon Echo Dot

While using the Echo I feel a bit like talking to Hal 9000 in the 1968 film “2001: A Space Odyssey” directed by Stanley Kubrick. Echo does not yet have an attitude.

Big Data – How to create it or get access to it?

Big Data – Nothing new anymore. Occasionally still used as buzzword, but for many company it became a productive tool to analyze huge volumes of data. I noticed the term Big Data disappeared from the 2015 and 2016 Gartner report “Hype Cycle for Emerging Technologies Identifies the Computing Innovations That Organizations Should Monitor” (compare the 2013 and 2014 report), I guess it jumped straight into the plateau of productivity.

We know the definition (volume, velocity, variety, plus variability and complexity), read books about, join conferences and meetups but for a developer (outside a corporate environment with access to some kind of big data) the question remains “How do I get Big Data”. While we have access to the various tools and platforms there is no stream we can easily tap in. Of course you could create random data in the millions but this would not create content that you could analyze. There are efforts to publish data accesible to the public (open data), but it is hardly a large volume and it is usually not streaming.

In the attempt to get at least a small portion of Big Data, I only found Twitter to play with. As a message based social networking service it certainly falls into the Big Data space with more than 310 million active users and 6.000 tweets a second (from 5.000 tweets a day in 2007). The 3 V’s are ticked and fortunately Twitter gives us API access to the data for developers. You can search the tweets, retrieve information about user accounts and listen to the status stream (though you can tap into the public stream only which is supposedly 1% of all, the gardenhose and firehose is off limits, you only get expensive access to it through some data resellers). Still we can poke our nose into Big Data ‘lite’.

I did some experiments with the Twitter search and streaming API, also in the context of aviation and airport. I started to persist trends, search results and filtered live stream into MongoDB. I will share some of my findings soon.

Twitter Stream

Twitter Stream

 

Update DynDNS hosts with Java and HttpComponents

I was looking for a way to update the DynDNS hosts pointing to my EC2 instances that run only on demand (controlled by an web application). Yes, there are apps and tools to let the server itself update his DynDNS hosts, but I want to do it from a central application. The DynDNS API description you find here, unfortunately there are no samples. But if you familiar with REST calls, shouldn’t be a big issue. For those who to get running quick, here the key code. To experiment, just create a simple Java application with Netbeans (or any other IDE), download the HttpComponents from Apache and add the library files to your project.

Libraries

commons-codec-1.4.jar
commons-logging-1.1.1.jar
httpclient-4.1.1.jar
httpclient-cache-4.1.1.jar
httpcore-4.1.jar
httpmime-4.1.1.jar

Sourcecode to update an IP address

void updateDynDNS() {
...
// replace with your own data !
String hostName = "whateveryourdomainnameis.selfip.org";
String hostIP = "1.2.3.5";
String userName = "user";
String userPassword = "password";
int responseCode;

try {

// Encode username and password
BASE64Encoder enc = new sun.misc.BASE64Encoder();
String userpassword = userName + ":" + userPassword;
String encodedAuthorization = enc.encode(userpassword.getBytes());

// Connect to DynDNS
URL url = new URL("http://members.dyndns.org/nic/update?hostname=" + hostName + "&myip=" + hostIP);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("User-Agent", "Demo DynDNS Updater");
connection.setRequestProperty("Authorization", "Basic " + encodedAuthorization);

// Execute GET
responseCode = connection.getResponseCode();
System.out.println(responseCode + ":" + connection.getResponseMessage());

// Print feedback
String line;
InputStreamReader in = new InputStreamReader((InputStream) connection.getContent());
BufferedReader buff = new BufferedReader(in);
do {
line = buff.readLine();
System.out.println(line);
} while (line != null);

connection.disconnect();

} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}

}
...

Up to you to embed into your application and do proper exception handling.

In a separate tutorial I will describe the basics of an EC2 controlling application using the AWS SDK for Java.

Android Market Access and Statistics

After some investigation I found a few more websites that reflect the current Android Market and allow you browsing and searching in an easier way than using the original market application. AndroLib has a page with some statistics, some figures might be estimated, have a look by yourself. It seems Google does not really give full access to the raw data of the market, though there is an API that helps you to create your own market browser (and no, it does not help you to iterate through the database!). I try to create my own statistics, the result over 1 hour: Roughly 50 new applications with 15 of them in the Entertainment area.

Android Market in 1 hour