XML-Interface: Difference between revisions

From FSAirlinesWiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(14 intermediate revisions by 6 users not shown)
Line 1: Line 1:
The XML-Interface is the core of the [[VA Integration Kit]]. It has been designed to give VA Administrators with the knowledge of dynamic web techniques the possibility to create their own layout and perfectly integrate the information into their own website using XML data from FSAirlines.  
The XML-Interface is the core of the [[VA Integration Kit]]. It has been designed to give VA Administrators with the knowledge of dynamic web techniques the possibility to create their own layout and perfectly integrate the information into their own website using XML data from FSAirlines.  
'''This interface is officially deprecated, all functions using username and password will be disabled 1 August 2023'''


==Access Restriction==
==Access Restriction==
Line 10: Line 12:
==Basic Usage==
==Basic Usage==
The data can be received using HTTP calls to the interface script and add the desired function to the parameters. Here is an example request:
The data can be received using HTTP calls to the interface script and add the desired function to the parameters. Here is an example request:
<pre>http://www.fsairlines.net/va_interface.php5?function=getPilotList&va_id=7</pre>
<pre>http://www.fsairlines.net/va_interface.php?function=getPilotList&va_id=7</pre>
As you can see there is the interface script ''va_interface.php5'', the function ''getPilotList'' and one function parameter ''va_id=7''. Some functions require additional parameters, these can be appended after the ''va_id''.
As you can see there is the interface script ''va_interface.php'', the function ''getPilotList'' and one function parameter ''va_id=7''. Some functions require additional parameters, these can be appended after the ''va_id''.


The result of the request will be given in xml format with the base-tag being ''<fsa_output>''. This tag has the attributes ''version'' and ''success'' which show the version number of the interface and if the request succeeded or not. In case of a failure the ''success''-attribute shows the error message. The following example shows the return text of the above function:
The result of the request will be given in xml format with the base-tag being ''<fsa_output>''. This tag has the attributes ''version'' and ''success'' which show the version number of the interface and if the request succeeded or not. In case of a failure the ''success''-attribute shows the error message. The following example shows the return text of the above function:
Line 25: Line 27:
<?php
<?php
   $objDOM = new DOMDocument();
   $objDOM = new DOMDocument();
   $objDOM->load("http://www.fsairlines.net/va_interface.php5?function=getPilotList&va_id=7");
   $objDOM->load("http://www.fsairlines.net/va_interface.php?function=getPilotList&va_id=7");


   //uncomment to show raw xml-data
   //uncomment to show raw xml-data
Line 129: Line 131:
| va_id, ac_id
| va_id, ac_id
| SUCCESS, NOT FOUND
| SUCCESS, NOT FOUND
| id, va_id, acdb_id, location, va_id, user_id, lease_id, fleet_id, status, value, registration, fuel, state, ac_name, stateeng1, stateeng2, stateeng3, stateeng4, stategear, statehull, img_path
| id, va_id, acdb_id, location, va_id, user_id, lease_id, fleet_id, status, value, registration, fuel, state, ac_name, stateeng1, stateeng2, stateeng3, stateeng4, stategear, statehull, img_path, pax_economy, pax_business, pax_first, config_name
|-
|-
| getAircraftDBData
| getAircraftDBData
Line 249: Line 251:
{| class="wikitable"
{| class="wikitable"
! Function
! Function
! Parameters<ref name="params">Parameters in brackets are optional</ref>
! Parameters in brackets are optional
! Return Codes
! Return Codes
! Data
! Data
Line 256: Line 258:
| va_id
| va_id
| SUCCESS, NOT FOUND
| SUCCESS, NOT FOUND
| departure, arrival, passengers, cargo, user_id, ac_id, flightstate, timestamp, number, <span style="background-color:#B9FFC5;">lon, lat</span>
| departure, arrival, passengers, cargo, user_id, ac_id, flightstate, timestamp, number, lon, lat, pax_economy, pax_business, pax_first
|-
|-
| getBookedFlights
| getBookedFlights
| va_id
| va_id
| SUCCESS, NOT FOUND
| SUCCESS, NOT FOUND
| departure, arrival, passengers, cargo, user_id, ac_id, number
| departure, arrival, passengers, cargo, user_id, ac_id, number, pax_economy, pax_business, pax_first
|-
|-
| getFlightReports
| getFlightReports
| va_id, (acdb_id), (ac_id), (pilot_id), (days), (count)
| va_id, (acdb_id), (ac_id), (pilot_id), (days), (count)
| SUCCESS, NOT FOUND
| SUCCESS, NOT FOUND
| id, dep, arr, pln_arr, ts, pax, ac_type, distance, rating, salary, income, pilot_id, pic, pid, fuel_used, flighttype, hours, ac_id, number, deptime, arrtime, pln_deptime, pln_arrtime, route_id, va_id, va
| id, dep, arr, pln_arr, ts, pax, ac_type, distance, rating, salary, income, pilot_id, pic, pid, fuel_used, flighttype, hours, ac_id, number, deptime, arrtime, pln_deptime, pln_arrtime, route_id, va_id, va, <span style="background-color:#B9FFC5;">pax_economy, pax_business, pax_first</span>
|-  
|-  
| getReportDetail
| getReportDetail
| va_id, report_id
| va_id, report_id
| SUCCESS, NOT FOUND
| SUCCESS, NOT FOUND
| id, ac_type, ac_id, pic, pilot_id, number, dep, pln_arr, arr, deptime, loc_deptime, arrtime, loc_arrtime, hours, ts, flightstate, rating, ratingreasons, distance, pax, ticket, crew, salary, fuelprice, fuel_bought, fuel_used, profit, version, simrate, multiplier, bonus, cargo, cargo_kg, flighttype, comment, cheat
| id, ac_type, ac_id, pic, pilot_id, number, dep, pln_arr, arr, deptime, loc_deptime, arrtime, loc_arrtime, hours, ts, flightstate, rating, ratingreasons, distance, pax, ticket, crew, salary, fuelprice, fuel_bought, fuel_used, profit, version, simrate, multiplier, bonus, cargo, cargo_kg, flighttype, comment, cheat, <span style="background-color:#B9FFC5;">vs, pax_economy, pax_business, pax_first, ticket_business, ticket_first, fuel_start, fuel_dep, fuel_takeoff, fuel_land, fuel_finish, ticket_factor, interface, simversion, os</span>
|-
|-
| getRouteData
| getRouteData
| va_id, route_id
| va_id, route_id
| SUCCESS, NOT FOUND
| SUCCESS, NOT FOUND
| id, va_id, cs_vaid, number, dep, arr, deptime, arrtime, simrate, days, price, state, flighttype
| id, va_id, cs_vaid, number, dep, arr, deptime, arrtime, simrate, days, price, state, flighttype, acdb_list, ac_id, remarks, route, limit_pax, limit_cargo
|-
|-
| getRouteList
| getRouteList

Latest revision as of 23:39, 6 July 2023

The XML-Interface is the core of the VA Integration Kit. It has been designed to give VA Administrators with the knowledge of dynamic web techniques the possibility to create their own layout and perfectly integrate the information into their own website using XML data from FSAirlines.

This interface is officially deprecated, all functions using username and password will be disabled 1 August 2023

Access Restriction

In order to be able to receive data from the XML-Interface the domain of your VA's website must be registered in our database. There are different access levels available:

  • Read only access for your VA
  • Read and write access (except account creation) for your VA. This access level will be given to you initially.
  • Read and write access for your VA. This access level will be given to your VA if you show our privacy policy on your registration page.

To request one of these access levels, please contact the admins using a support ticket and don't forget to add the domain of your website.

Basic Usage

The data can be received using HTTP calls to the interface script and add the desired function to the parameters. Here is an example request:

http://www.fsairlines.net/va_interface.php?function=getPilotList&va_id=7

As you can see there is the interface script va_interface.php, the function getPilotList and one function parameter va_id=7. Some functions require additional parameters, these can be appended after the va_id.

The result of the request will be given in xml format with the base-tag being <fsa_output>. This tag has the attributes version and success which show the version number of the interface and if the request succeeded or not. In case of a failure the success-attribute shows the error message. The following example shows the return text of the above function:

<fsa_output version="1.0" success="SUCCESS">
  <data id="1" name="Konrad" surname="Pustka" va_user="SNA101" location="EDDM" lastactive="1287330550" budget="198144" />
  <data id="2" name="Claudio" surname="Gusmini" va_user="SNA102" location="EDDM" lastactive="1286366261" budget="216405101" />
</fsa_output>

Inside the fsa_output-tag there are the data-tags which contain all the information. To use this data in your own webpage you need some knowledge in dynamic web-programming, for example PHP. We can't give you a complete introduction into PHP, but you can always have a look at the Official FSAirlines Integration Pack and see how we readout the data there.

If you need something to get started here's a small example PHP-script showing a list of your pilots' names. Just replace the va_id by your own.

<?php
  $objDOM = new DOMDocument();
  $objDOM->load("http://www.fsairlines.net/va_interface.php?function=getPilotList&va_id=7");

  //uncomment to show raw xml-data
  //echo $objDOM->saveXML();

  $dataNodes = $objDOM->getElementsByTagName("data");
  foreach( $dataNodes as $node )
  {
    $name = $node->getAttribute("name");
    $surname = $node->getAttribute("surname");
    echo "{$name} {$surname} <br/>";
  }
?>

Data

The following section contains a detailed list of all the request-functions with their return values. Lately added options are marked green.

Parameters

All the request functions use parameters which need to be appended. The following table shows all the parameters and their meaning.

Parameter Meaning
ac_id ID of the aircraft. Is part of the data received from other functions (e.g. getAircraftList).
accept_pp Must be set '1' if Privacy Policy is accepted.
acdb_id ID of the aircraft type. Is part of the data received from other functions (e.g. getAircraftList).
airport Starting airport. Where the user should be placed first.
arr ICAO code of the arrival airport.
count Number past flights which should be displayed.
country Name of the country.
days Number of past days from now which should be displayed.
dep ICAO code of the departure airport.
email E-Mail of the user.
fleet_id ID of the fleet. Is part of the data received from other functions.
from_ts UNIX timestamp of the date where the listing should start.
givenname Given name of the user.
icao ICAO code of the airport.
passwd Password of the pilot (MD5 encrypted).
password Password of the user.
pilot_id ID of the pilot. Is part of the data received from other functions.
report_id ID of the report. Is part of the data received from other functions.
surname Surname of the user.
to_ts UNIX timestamp of the date where the listing should end.
user Username of the pilot.
username Requested username.
va_id ID of the Virtual Airline. Is displayed on the Overview page.

Aircraft Data

Function Parameters Return Codes Data
getAircraftData va_id, ac_id SUCCESS, NOT FOUND id, va_id, acdb_id, location, va_id, user_id, lease_id, fleet_id, status, value, registration, fuel, state, ac_name, stateeng1, stateeng2, stateeng3, stateeng4, stategear, statehull, img_path, pax_economy, pax_business, pax_first, config_name
getAircraftDBData va_id, acdb_id SUCCESS, NOT FOUND id, manufacturer, type, icao, passengers, price, fuel, dow, mtow, speed, engines, cargo, mzfw, market_only, range
getAircraftDBList va_id SUCCESS, NOT FOUND id, manufacturer, type, icao
getAircraftList va_id SUCCESS, NOT FOUND id, acdb_id, icao, value, location, registration, state, ac_name, status, fleet_id, fuel
getAircraftStats va_id, ac_id SUCCESS, NOT FOUND flights, hours, distance
getFleetAircraftList va_id, fleet_id SUCCESS, NOT FOUND id, acdb_id, icao, value, location, registration, state, ac_name, status, fleet_id, fuel
getFleetList va_id SUCCESS, NOT FOUND id, name
getFleetStats va_id SUCCESS, NOT FOUND id, flights, hours, distance, last, fuel_used, profit, cargo_kg, pax
getLeasedAircraftList va_id SUCCESS, NOT FOUND id, acdb_id, icao, value, location, registraion, state, ac_name, status, fleet_id, fuel, va_id, name, expire
getPeriodFleetStats va_id, from_ts, to_ts SUCCESS, NOT FOUND id, flights, hours, distance, last, fuel_used, profit, cargo_kg, pax

Airport Data

Function Parameters Return Codes Data
getAirportData va_id, icao SUCCESS, NOT FOUND id, name, iata, icao, city, country, la_g, la_p, la_s, la_d, lat, lo_g, lo_p, lo_s, lo_d, lon, altitude, length, fuel, size
getAirportList va_id SUCCESS, NOT FOUND icao, name, city, country, fuel, lat, lon

Airline Data

Function Parameters Return Codes Data
getAirlineData va_id, id (=va_id) SUCCESS, NOT FOUND id, name, base, code, budget, homepage, logo_l, logo_s, price (deprecated, will be removed in next release), reputation, pilotcharge, multiplier, mission
getAirlineStats va_id SUCCESS, NOT FOUND id, flights, rating, hours, distance, last, fuel_used, pax, cargo_kg
getCountryStats va_id, country SUCCESS, NOT FOUND va_name, id, flights, rating hours, profit, distance, last, fuel_used, pax, cargo_kg
getRankList va_id SUCCESS, NOT FOUND id, name, short, settings, pilots, aircrafts, fleet, flights, partnerships, advertisements, fleet_id

Financial Data

Function Parameters Return Codes Data
getLast10Transactions va_id SUCCESS, NOT FOUND ts, value, reason
getNegTransactionSums va_id SUCCESS, NOT FOUND value, reason
getPosTransactionSums va_id SUCCESS, NOT FOUND value, reason

Flight Data

Function Parameters in brackets are optional Return Codes Data
getActiveFlights va_id SUCCESS, NOT FOUND departure, arrival, passengers, cargo, user_id, ac_id, flightstate, timestamp, number, lon, lat, pax_economy, pax_business, pax_first
getBookedFlights va_id SUCCESS, NOT FOUND departure, arrival, passengers, cargo, user_id, ac_id, number, pax_economy, pax_business, pax_first
getFlightReports va_id, (acdb_id), (ac_id), (pilot_id), (days), (count) SUCCESS, NOT FOUND id, dep, arr, pln_arr, ts, pax, ac_type, distance, rating, salary, income, pilot_id, pic, pid, fuel_used, flighttype, hours, ac_id, number, deptime, arrtime, pln_deptime, pln_arrtime, route_id, va_id, va, pax_economy, pax_business, pax_first
getReportDetail va_id, report_id SUCCESS, NOT FOUND id, ac_type, ac_id, pic, pilot_id, number, dep, pln_arr, arr, deptime, loc_deptime, arrtime, loc_arrtime, hours, ts, flightstate, rating, ratingreasons, distance, pax, ticket, crew, salary, fuelprice, fuel_bought, fuel_used, profit, version, simrate, multiplier, bonus, cargo, cargo_kg, flighttype, comment, cheat, vs, pax_economy, pax_business, pax_first, ticket_business, ticket_first, fuel_start, fuel_dep, fuel_takeoff, fuel_land, fuel_finish, ticket_factor, interface, simversion, os
getRouteData va_id, route_id SUCCESS, NOT FOUND id, va_id, cs_vaid, number, dep, arr, deptime, arrtime, simrate, days, price, state, flighttype, acdb_list, ac_id, remarks, route, limit_pax, limit_cargo
getRouteList va_id SUCCESS, NOT FOUND id, number, dep, dep_country, arr, arr_country, deptime, arrtime, simrate, days, price, state, flighttype, acdb_list, ac_id

Pilot Data

Function Parameters Return Codes Data
getPeriodPilotStats va_id, from_ts, to_ts SUCCESS, NOT FOUND id, flights, rating, hours, distance, last, fuel_used, profit, cargo_kg, pax
getPilotData va_id, pilot_id SUCCESS, NOT FOUND id, name, surname, user, va_user, rank_id, location, budget, lastactive, active, sigac, timezone, weightunit, language, msgmail, rank, flights, rating, hours, distance, pax, cargo_kg, picture
getPilotHours va_id, pilot_id SUCCESS, NOT FOUND id, manufacturer, type, icao, hours
getPilotList va_id SUCCESS, NOT FOUND id, name, surname, user, va_user, rank_id, location, last_active, status, budget
getPilotRatings va_id, pilot_id SUCCESS, NOT FOUND id, training, manufacturer, type
getPilotStats va_id SUCCESS, NOT FOUND id, flights, rating, hours, distance, last, fuel_used, profit, cargo_kg, pax
getPilotStatus va_id, pilot_id SUCCESS, NOT FOUND ac_id, route_id, departure, arrival, dep_time, dist, duration, status, lon, lat, flightstate, passengers, income, ticket, timestamp, cargo, multiplier, flighttype

Flight Booking

Function Parameters Return Codes Data
bookFlight va_id, pilot_id, passwd, route_id, ac_id SUCCESS, NOT FOUND, FLIGHT BOOKED, GROUNDED, SUSPENDED, VA INACTIVE success, message, codeshare, codeshare_msg
cancelFlight va_id, pilot_id, passwd SUCCESS, NOT FOUND result, loss
getBookableRoutes va_id, pilot_id SUCCESS, NOT FOUND, FLIGHT BOOKED, GROUNDED, SUSPENDED, VA INACTIVE number, dep, arr, deptime, arrtime, id, state, simrate, flighttype, training, price, list, ac_id
getBookableAircraft va_id, pilot_id, route_id SUCCESS, NOT FOUND, FLIGHT BOOKED, GROUNDED, SUSPENDED, VA INACTIVE type, registration, state, id, name, fuel
getBookStatus va_id, pilot_id SUCCESS, NOT FOUND status

Miscellaneous User Functions

Function Parameters Return Codes Data
createAccount va_id, givenname, surname, username, email, password, airport, accept_pp SUCCESS, NOT FOUND success, message, code
getPilotID va_id, user, passwd SUCCESS, NOT FOUND id
getPrivacyPolicy va_id SUCCESS policy
getTransferCost va_id, arr, dep SUCCESS, NOT FOUND cost
transferPilot va_id, pilot_id, passwd, icao SUCCESS, NOT FOUND, INSUFFICIENT FUNDS cost
getDistance va_id, icao_from, icao_to SUCCESS, NOT FOUND distance
getMetar va_id, icao SUCCESS, NOT FOUND metar

Notes

<references />

Requested additional functions

The following list contains all the functions which were requested by users but aren't implemented yet.

  • Create, edit and delete routes