Follow

Integrating the Servasport XML feed

Integrating the Servasport XML Feed

 

Fixtures and Results Developer Summary

Part 1 - Returning XML from the Server

There is a servlet located at /api/fixtures/xml. For testing and development purposes this servlet can be accessed from the Servasport development server at:

http://people.gaa.ie/api/fixtures/xml

The servlet will take the following parameters:

ID Parameters
  • clubID=1234
                Get all fixtures and results for club 1234
  • compID=1234
                Get all fixtures and results for competition 1234
  • venueID=1234
                Get all fixtures and results for venue 1234
  • compGroupID=1234
                Get all fixtures and results for competitions that are part of competitionGroup 1234
  • countyBoardID=1234
                Get all fixtures for clubs from County Board 1234
  • owner=1234
                Gets all of the fixtures that a county owns, plus all of the fixtures that county is participating in.
  • uniqueID=12345
               Get the result/Fixture for the specific game

Include Parameters
  • includeCountyGames= Y/N
               Include fixtures that the County is participating in.(always defaulted to Y when it's not included)
  • includeProvincialGames= Y/N
               Include fixtures that the province is participating in.(always defaulted to Y when it's not included)
  • includeClubGames= Y/N
               Include fixtures that clubs are participating in.(always defaulted to Y when it's not included)
  • includeCollegeGames= Y/N
               Include fixtures that the College is participating in.(always defaulted to Y when it's not included)
  • includeSchoolGames= Y/N
               Include fixtures that the School is participating in.(always defaulted to Y when it's not included)

Fixtures and Results Parameters
  • fixturesOnly=Y/N
               Only return fixtures
  • resultsOnly= Y/N
               Only return results

Date Parameters
  • daysPrevious=X
               Gets results for the previous X days (ignores fix/results filter mutually exclusive with daysAfter)
  • daysAfter=X
               Gets fixtures for next X days (ignores fix/results filter - mutually exclusive with daysPrevious)
  • dateFrom=20091230
               Gets fixtures/results from date 2009/12/30 combined with dateTo (ignores fix/results filter)
  • dateTo=20091230
               Gets fixtures/results from date 2009/12/30 combined with dateFrom (ignores fix/results filter)
  • reverseDateOrder=Y/N
              Reverse the Order of the fixtures based on date.
Archive Parameters
  • showArchive=Y/N
               If your site has an archive section, this parameter is needed to display the historical results, as by default the feed will not return these results.
  • season= (2010)
              For searching historical results use this parameter with the above parameter (showArchive) to retrieve all results from a certain season.

Y/N Parameters

  • leagueTable=Y/N

              Generate League Table XML if Y (must be used in conjunction with compID)

  • noTBC=Y/N

              Add this parameter to not show TBC fixtures

  •  showByeGames = (Y/N)

              Will display all fixtures where the away team is set as BYE

  • next7Days = (Y/N)

              Will filter fixtures to display only the fixtures occurring in the next 7              days

  • orderTBCLast=Y/N

             Add this parameter to show the TBC fixtures at the bottom of this list.

  • leagueTableOnly= Y/N

             Returns a League table with no fixtures or results (Must be used in conjunction with a CompID or CompGroupID

  • orderByRank=Y/N
            Add this parameter to order the competitions according to  their Rank.
        
Variable Parameters
  • compLevel=(Senior, Intermediate, Junior, U21, Minor, Juvenile, Underage)
             Get all the fixtures/results for that Level
  • compAgeLevel=(Senior, U21, U20, U19, U18, U17, U16, U15, U14, U13, U12, U11, U10, U9, U8)
             Get all fixtures/results for that age level
  • provinceName= (Ulster, Munster, Leinster, Connaught, Britain, NorthAmerica, Europe, Canada,NewYork)

             Return all fixtures for the named province

  •  format = (league/knockout)

             When used with a league/knockout competition will filter the fixtures to show only those specified.

             e.g. format=knockout will return only the finals for a league/knockout competition

  • compStyle = (football/hurling)

             Will filter fixtures/results to display only those of a particular style

  • language=irish/english
             Will display the club name in Irish or English, the default languag is English and will show the Club Display Name.    
  • gender=(M/F)
              Add this parameter to the list with no value and it will pull out female fixtures only.

An example of a typical query to the servlet might be:

http://people.gaa.ie/api/fixtures/xml?compID=287&leagueTable=Y&resultsOnly=Y

 

In response you will get an XML document with the requested info.

At this point the XML may be parsed with whatever tools are at the developers disposal and displayed however is seen fit.

Click here for some worked examples of XML

 

Part 2 - The PHP Library

ServaSport have also provided a PHP library and example PHP code as a starting point for those developers wishing to use PHP as their parsing and formatting medium. To use the PHP library follow the steps below.

1. Copy the FixtureLib.php library into your deployment environment. 2. Modify the $xml_location at the top of the library to point to the live server or the development server if testing. For example:

$server = http://people.gaa.ie


3. In the results page load the library using the following php code:

function __autoload($class_name) {
require_once '<relative path to library> . $class_name . '.php';
}
$lib = new FixtureLib($_REQUEST);

4. In the above example, the library gets passed the same request parameters that were received on the php page. So if for example, the results page was accessed with the url: http://myserver.com/fixtureresult.php?compID=287&leagueTable=Y, then the parameters compID=287 and leagueTable=Y would be passed to the api/fixtures/xml servlet. This is useful for quickly creating one page for a particular competition or club.

5. More precise control over the content can be achieved by passing individual parameters directly to the library. This could be used for displaying fixtures and results from several different competitions and clubs on the same page. To do this, a new library would be instantiated for each set of request parameters. For example to show the results and results from competition 287 with league table and club 2166, the following two calls would be made:

$comp287lib = new FixtureLib( array( "compID"=>"287", "leagueTable"=>"Y" ));
$club2166lib = new FixtureLib( array( "clubID"=>"2166" ));

6. There are now up to 3 variables that can be accessed from the library:

$lib->leagueTable //Available if a league table was requested in the parameters. Of type LeagueTable
$lib->fixtures //An array of fixtures/results in date order. Of type array(Fixture)
$lib->fixturesGroupedByDate //A convience variable. Fixtures split into Groups based on their date. Of type (array (Date, array(Fixture))

7. The data structure of the variable types is outlined below:

class LeagueTable
{
public $competition_name;
public $ccc_ruling;
public $competition_short_name;
public $entries; // This is an array of type LeagueEntry - see below
public $error;
}

class LeagueEntry
{
public $team_name;
public $team_id;
public $rank;
public $points;
public $games_played;
public $games_won;
public $games_lost;
public $games_drawn;
public $points_for;
public $points_against;
}

class FixtureGroup //fixturesGroupedByDate
{
public $date;
public $fixtures; //This is an array of type Fixture - see below.
}

class Fixture {
public $date;
public $time;
public $competition_name;
public $competition_short_name;
public $competition_id;
public $comp_style;
public $comp_level;
public $round_name;
public $club_1_name;
public $club_1_id;
public $team_1_name;
public $club_2_name;
public $club_2_id;
public $team_2_name;
public $venue_name;
public $venue_id;
public $referee_surname;
public $referee_forename;
public $result;
public $team_1_goals;
public $team_1_points;
public $team_2_goals;
public $team_2_points;
public $notes;
public $tv;
public $postponed;
public $abandoned;
public $never_played;
public $extratime_playable;
public $replay;
public $refixture;
public $parent_competition_name;
public $parent_competition_id;
public $team_1_conceded;
public $team_2_conceded;
public $report_url;
public $sponsor;
public $sponsor_position;
}

Servasport would be happy to answer any questions or respond to any requests for further information: GAA Support

Sample code

Please see the following files for an examples of a project using the feed:

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments