The Airport Demo Data

In the US Airport Demo Data example a Lua script, using the esi-lcurl-http-client library, calls a free web service on the internet, in this case information from the United States Federal Aviation Agency. The data is retrieved in XML format, which will then be parsed into objects in the I/O Model.

The FAA US Airport data web service used in this example is no longer servicing http requests and will return an error when called. However, the example is being left up as it demonstrates how to call an http web service using Lua and how to process a returned XML data file in the system. The Lua script used in this example can be modified to work with other web services.

Installation

To create the US Airport Data example automatically, just run the Lua script in the Console Display.

local exm = require('esi-examples')
exm:SETUP({{"usairportdata"}})
In Lua Security Mode Restrictive, for the installation script as well as the actual example to work, additional configuration of Lua permissions is required. See Lua Security for background information and examples.

On installation of this example, the Lua script for the 'DataProcessing' Generic Item is executed immediately, creating a folder structure 'Examples/LUA/HTTP Access/US Airport Data' underneath the Core object in I/O Model. This will take a few seconds. When the script has finished, the new branch in the I/O Model looks like this:

The Airport Example in the I/O Model
Figure 1. The Airport Example in the I/O Model

Then the script in the 'Create Airport KPI Model' Action Item automatically generates the corresponding objects in the KPI Model. When the script is finished, the Action Item is disabled. The KPI Model shows the newly generated objects:

The Airport Example in the KPI Model
Figure 2. The Airport Example in the KPI Model

More Information

This example will be used in the Lua HTTP Example in the Jumpstart for Using Lua Scripting.