|
Webmasters
|
REST ServicesThis page shows how to include data such as league tables and fixtures from the South Lacrosse site within your own web pages, or use it for any other kind of processing. If you have any trouble using these services please email Dave Slaughter at webmaster@southlacrosse.org.uk. And thanks to Dan Scott for suggesting the idea. BackgroundData from the South Lacrosse site is made available via REST services. If you don't know what REST is, don't worry - you don't need to be familiar with it to use these services. REST is an architectural style, not a standard, and is based on standard Web technologies. This means it should be relatively simple to use, even for novice web programmers. If you want to read up on it you might want to see the Rest page at Wikipedia. How it WorksWe publish resources at specified URLs, for example the Men's tables are at www.southlacrosse.org.uk/rest/tables/mens/. This contains the data in XML format, e.g. <?xml version="1.0" encoding="UTF-8"?>
<league-tables>
<division>
<division-name short="Prem">Premier Division</division-name>
<team>
<team-name>Hitchin</team-name>
<won>14</won>
<drawn>0</drawn>
<lost>2</lost>
<points>44</points>
<for>216</for>
<against>79</against>
</team>
<team>
<team-name>Hillcroft</team-name>
<won>13</won>
<drawn>2</drawn>
<lost>1</lost>
<points>44</points>
<for>180</for>
<against>120</against>
</team>
...(more teams)
</division>
... (more divisions)
</league-tables>
XML is used because it can be easily read by computer systems, but can also be understood by humans. All modern computer languages have routines for dealing easily with XML, e.g. PHP, Perl, Python, ASP, Java, .NET etc. For a full list of resources available see the list of services below. These resources can now be used by any client - the most typical is to use it to build part of a web page on a different site, using some kind of scripting language. For example, you could include the league tables within your club's website, using data from South Lacrosse. The diagram below shows how.
In order to speed up access to your web page, the XML data is usually cached on your own server, and only retrieved if the local copy is over a predefined age - say 2 hours. This means most times only actions 1. and 4. occur. Additionally it makes you a good neighbour, by cutting down on the processing and bandwidth used by the South Lacrosse site. ExamplesThe examples use PHP, and require the curl extension (this is usually compiled in, so if your site has PHP it is very unlikely not to have curl). All the examples use utilities in the rest.inc file which contains code to simplify access to REST services. It has routines for fetching the data from the South Lacrosse server, and parsing the returned XML files into more useable data structures. It will also cache the XML data on your own server, and enables cacheing pages in the browser, so providing fast response times. The complete examples are also available as a zip file.
Services AvailableIf you use these services please credit where you got the data from with a link back to the South Lacrosse site, for example Data provided by southlacrosse.org.uk The HTML markup is as follows: <p><small>Data provided by <a href="http://www.southlacrosse.org.uk/">southlacrosse.org.uk</a></small></p> Please note: URLs are case specific, so /Prem is not the same as /prem.
Team NamesTo find the team name to use in the URL go to the Men's fixtures or Women's fixtures page and select your team. The address of the page will include the team name you need to use, for example if you wanted fixtures for Bath University:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||