API - Season Bests

Retrieve a skater's season bests.

URL

Type URL
XML http://speedskatingresults.com/api/xml/season_bests.php
JSON http://speedskatingresults.com/api/json/season_bests.php

Parameters

Name Description
skater

Skater ID (required)

A skater's ID can be found using the search table below. The skater ID can also be found as the s parameter on the URL for a skater's page. For example:

http://speedskatingresults.com/index.php?p=17&s=203

startFirst season to retrieve (optional)
endLast season to retrieve (optional)
distance

Distance (optional)

When the distance parameter is omitted, the season bests for all distances are returned. Specify a value (500, 1000, 1500, 3000, 5000 or 10000) for the distance parameter to retrieve the season best for that distance only.

  1. To retrieve the season bests for the current season, omit both the start and end parameters.
  2. To retrieve the season bests for a single season, set start to the season's starting year and omit end. For example, to retrieve the season bests for the 2010-2011 season, set start=2010.
  3. To retrieve the season bests for a range of seasons, set start to the first season's starting year and end to the last season's starting year. For example, to retrieve the season bests for the 2009-2010, 2010-2011 and 2011-2012 seasons, set start=2009 and end=2011.
  4. To retrieve the season bests for all seasons, set start=0 and omit end.
  5. The first season for which the SpeedskatingResults.com database contains season bests is 2007-2008.

Skater IDs

XML

Element Description
sbs

The collection of season bests

Attributes

  • skater - skater ID
season

A collection of a single season's best times

Attributes

  • start - Season start year (e.g. 2010 = 2010-2011 season)
recordA personal record
distanceRace distance
timeFinishing time
dateRace date (YYYY-MM-DD)
locationRace location

Example

API Query: http://speedskatingresults.com/api/xml/season_bests?skater=2057&start=2010&end=2011

<?xml version="1.0" encoding="utf-8" ?>
<sbs skater="2057">
  <season start="2010">
    <record>
      <distance>500</distance>
      <time>36,07</time>
      <date>2011-02-01</date>
      <location>Astana (KAZ)</location>
    </record>
    <record>
      <distance>1000</distance>
      <time>1.11,55</time>
      <date>2011-03-26</date>
      <location>Astana (KAZ)</location>
    </record>
  </season>
  <season start="2011">
    <record>
      <distance>500</distance>
      <time>35,48</time>
      <date>2012-04-01</date>
      <location>Astana (KAZ)</location>
    </record>
    <record>
      <distance>1000</distance>
      <time>1.10,53</time>
      <date>2012-01-21</date>
      <location>Salt Lake City (USA)</location>
    </record>
  </season>
</sbs>

JSON

Key Description
skater skater ID
seasons The collection of season bests
start Season start year (e.g. 2010 = 2010-2011 season)
records The collection of bests for a single season
distanceRace distance
timeFinishing time
dateRace date (YYYY-MM-DD)
locationRace location

Example

API Query: http://speedskatingresults.com/api/json/season_bests?skater=2057&start=2010&end=2011

{
  "skater":2057,
  "seasons":[
    {
      "start":2010,
      "records":[
        {"distance":500, "time":"36,07", "date":"2011-02-01", "location":"Astana (KAZ)"},
        {"distance":1000, "time":"1.11,55", "date":"2011-03-26", "location":"Astana (KAZ)"}
      ]
    },
    {
      "start":2011,
      "records":[
        {"distance":500, "time":"35,48", "date":"2012-04-01", "location":"Astana (KAZ)"},
        {"distance":1000, "time":"1.10,53", "date":"2012-01-21", "location":"Salt Lake City (USA)"}
      ]
    }
  ]
}

Example Web Page

The sample web page provides a very basic example of how XML data may be retrieved from SpeedskatingResults.com. It makes use of the jQuery library to handle the the interaction with the XML API.

Season Bests Example Page (XML)

Season Bests Example Page (JSON)

HTML Code (XML)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <style type="text/css" media="screen">
    body {font-family: 'Lucida Grande', Verdana, Arial, sans-serif; padding: 5px;}
    table.records {margin: 1em; border-collapse: collapse; }
    table.records td {padding: .2em .5em; }
    table.records td.distance {width: 5em; font-weight: bold;}
    table.records td.time {width: 5em; text-align: right;}
    table.records td.date {}
    table.records td.location {width: 15em;}
    a {color: navy; text-decoration: none; font-weight: bold;}
    a:visited {font-weight: normal;}
    a:hover {color: crimson;}
  </style>
  <title>API Example - PR/SB</title>
  <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
  <script type="text/javascript">
  $(document).ready(function(){
    $.ajax({
      type: "GET",
      url: "http://speedskatingresults.com/api/xml/season_bests.php",
      data: "skater=273&start=2011",
      dataType: "xml",
      success: function(xml) {
        if ($(xml).find('season').first().attr('start') != null) {
          var seasonStart = parseInt($(xml).find('season').first().attr('start'));
          $('#sb_header').html('Season Bests (' + seasonStart + '-' + (seasonStart + 1) + ')');
          $(xml).find('record').each(function() {
            var distance = $(this).find('distance').text()+"m";
            var time = $(this).find('time').text();
            var date = $(this).find('date').text();
            var location = $(this).find('location').text();
            $('<tr></tr>').html('<td class="distance">'+distance+'</td><td class="time">'+time+
              '</td><td class="date">'+date+'</td>'+
              '<td class="location">'+location+'</td>').appendTo('#sbs');
          });
        }
      }
    });
  });
  </script>
</head>
<body>
  <h1>Tucker Fredricks (USA)</h1>
  <h2 id="sb_header"></h2>
  <table id="sbs" class="records">
  </table>
  <p><a href="http://speedskatingresults.com/index.php?p=18&s=273">Results</a> from
    <a href="http://speedskatingresults.com">SpeedskatingResults.com</a></p>
</body>
</html>

HTML Code (JSON)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <style type="text/css" media="screen">
    body {font-family: 'Lucida Grande', Verdana, Arial, sans-serif; padding: 5px;}
    table.records {margin: 1em; border-collapse: collapse; }
    table.records td {padding: .2em .5em; }
    table.records td.distance {width: 5em; font-weight: bold;}
    table.records td.time {width: 5em; text-align: right;}
    table.records td.date {}
    table.records td.location {width: 15em;}
    a {color: navy; text-decoration: none; font-weight: bold;}
    a:visited {font-weight: normal;}
    a:hover {color: crimson;}
  </style>
  <title>API Example - Season Bests</title>
  <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
  <script type="text/javascript">
  $(document).ready(function(){
    $.ajax({
      type: "GET",
      url: "http://speedskatingresults.com/api/json/season_bests.php",
      data: "skater=273&start=2011",
      dataType: "json",
      success: function(data) {
        var season = parseInt(data.seasons[0].start);
        
        $('#sb_header').html('Season Bests (' + season + '-' + (season + 1) + ')');
        data.seasons[0].records.forEach(function(r) {
          $('<tr></tr>').html('<td class="distance">'+r.distance+
            '</td><td class="time">'+r.time+
            '</td><td class="date">'+r.date+
            '</td><td class="location">'+r.location+'</td>').appendTo('#sbs');
        });
      }
    });
  });
  </script>
</head>
<body>
  <h1>Tucker Fredricks (USA)</h1>
  <h2 id="sb_header"></h2>
  <table id="sbs" class="records">
  </table>
  <p><a href="http://speedskatingresults.com/index.php?p=18&s=273">Results</a> from
    <a href="http://speedskatingresults.com">SpeedskatingResults.com</a></p>
</body>
</html>
SpeedskatingResults.com on Facebook