View Source

An API is an [Application Programming Interface|http://en.wikipedia.org/wiki/Application_programming_interface]. All sorts of people need FAI data and it should be delivered in a consistent form. *FAI needs an API*!

This is a very simple example of the sort of data FAI should make available for people to use in their applications.

Select items below to include that data in the resulting XML data output, then press *get XML*.

You are required to login, use either:
* username: *anonymous* password : _blank_
* For enhanced data, use your wiki login credentials. What enhanced data is supplied depends on what groups you are a member of in the wiki.

In a web browser this data is presented in a tree-like structure, that is what XML is. You can use the little - and + icons on the left side to collapse and expand different elements in the tree.

To return to this page, simply press the back button.

{html}
<form method="GET" action="https://www.flymicro.com/faidata/index.cfm">
<b>General stuff</b><br />
<input type="checkbox" name="data" value="members.all"> List of FAI members (not guaranteed to be correct)<br/>
<input type="checkbox" name="data" value="cima.classes.all"> List of CIMA classes<br />
<input type="checkbox" name="data" value="cima.delegates.all"> List of CIMA delegates<p>
<p>
<b>Microlight & Paramotor records</b><br />

<input type="checkbox" name="data" value="cima.records.WL1T"> WL1T - Weight-shift Control / Landplane / Flown solo / Thermal engine<br />

<input type="checkbox" name="data" value="cima.records.WL2T"> WL2T - Weight-shift Control / Landplane / Flown with two persons / Thermal engine<br />

<input type="checkbox" name="data" value="cima.records.AL1T"> AL1T - Movable Aerodynamic Control / Landplane / Flown solo / Thermal engine<br />

<input type="checkbox" name="data" value="cima.records.AL2T"> AL2T - Movable Aerodynamic Control / Landplane / Flown with two persons / Thermal engine<br />

<input type="checkbox" name="data" value="cima.records.PF1Tm"> PF1Tm - Paraglider Control / Foot-launched / Flown solo / Thermal engine / male<br />

<input type="checkbox" name="data" value="cima.records.PF2T"> PF2T - Paraglider Control / Foot-launched / Flown with two persons / Thermal engine<br />

<input type="submit" value="get XML">
</form>

{html}

see the [API Reference|API reference] for full syntax. This includes making it pretty with xsl stylesheets, for example[?data=members.america&xsl=1|https://www.flymicro.com/faidata/index.cfm?data=members.america&xsl=1] displays all FAI Members from the Americas in a user-friendly format.

h5. Making it useful
Programmers know how to use XML data like this, but it can also be used directly by desktop programs like Excel. While raw XML can be imported into spreadsheets it is sometimes a little bit complicated, but importing transformed data is child's play with a web-query.
* In excel 2003, open a new sheet.
* menu: Data --> import external data --> new web query.
* Put the URL in the address line (not forgetting the *&xsl=1* or *&xsl=2* to get the transformed version of the data) and press *Go*.
* The page appears, select the range of data you want to import, where in the sheet you want to import it to, and click *import*.
* Your data appears in the sheet.
* To refresh the data, select a cell somewhere in the imported data and click menu: Data --> Refresh Data.

h3. What this is
What you have here is a simple [RESTful web service|http://en.wikipedia.org/wiki/Representational_State_Transfer] delivering read-only data (Technically, it is a GET). The data itself is presented in a pre-defined [xml|http://en.wikipedia.org/wiki/XML]
format.

Security in this demo is at two levels:
* Transport across the web is down a secure https 'tunnel'.
* A login is required, but this can be *anonymous* for information already in the public domain.

With API's like this it is also possible to send data the other way. (PUT or POST) or DELETE. These options are not currently implemented.

h3. Purpose
The purpose of all this is just a simple demo to show the possibilities of the sort of data FAI should be making available, and a simple API to get it.

*Several things will be noticed:*
* No secure data is exposed to unauthenticated logins, eg email addresses. For this sort of thing a level of permissions is required.
* There should however be a lot more info, eg NAC names Etc which is not contained in this demo database.
* The primary objective of an API like this is data supply. It is not necessary for it to be able to deliver every possible query, for example the name of the NAC under which a World record was ratified, but it is necessary for it to deliver sufficient data that this could be determined from further processing. In this case the <fai_nation/> field would be used to join the two data sets.
* Since an API like this is designed to be called often, it is a good idea to have subsets which are capable of delivering reasonably small amounts of data. No point in delivering all 500+ microlight records if only the ones for a single class are needed.
* All data is encapsulated in a single <fai></fai> structure. While the whole purpose of this sort of thing is that it should be extensible, it would be very wise for FAI to create a basic structure which deals with the core data elements. The range of applications are vast, way more than this little demo and include sporting licences, competition entry lists, tracks, tasks, results... If all FAI associated data had a documented basic core structure then we are well on the way to having something *really useful*.
* Standard format allows data to go in different directions with some confidence that it will be understood by the recipient - for example it becomes easy to load competition results in a common format to the FAI website Etc.
* While it is recommended the <fai/> structure should be used to encapsulate everything possible, it should also be realized that there are some other formats commonly used for some things, eg [iCalendar|http://en.wikipedia.org/wiki/ICalendar] for calendars, [RSS|http://en.wikipedia.org/wiki/RSS] for news and [.igc|http://www.fai.org/gliding/system/files/tech_spec_gnss.pdf] for track files.
* When structured data like this is available, people will start using it in ways FAI never imagined. Since the data we're talking about is all in the public domain already - it can only be a good thing for FAI.

h3. Recommendation
There are many opportunities for structured FAI data, but there is no structure.
h5. It is strongly recommended a FAI wide Working Group is set up to establish this FAI structure.

h3. Further reading
[web services|http://en.wikipedia.org/wiki/Web_service ]
While this experimental API is not compliant, the [Atlassian REST API Design Guidelines|https://developer.atlassian.com/display/REST/Atlassian+REST+API+Design+Guidelines+version+1] is a very sensible approach to REST.