This project has moved. For the latest updates, please go here.

Liveresults public API

With the new release of the LiveResults webb it includes a public API that can be used by 3rd party developers to build applications, new interfaces, Apps for Smartphones among other things

If you have built an 3rd party app and want to include it in the liveresults official webb (on obasen.nu) for example. Contact Peter Löfås (PETER @ LOFAS . SE)

Changelog

September 10th 2014
  • Minor corrections of errors in the documentation and added informatiom about runner statuses

Hash to minimize transfer

Most methods in the API contains the possibility to supply a last_hash parameter in the query to only receive a new response if something have changed. This way datatransfer out from the servers can be minimized and data cached better to please use this functionality!

When data have not changed the API will return this response instead
    { "status" : "NOT MODIFIED" } 


You don't need to calculate the hash yourself, it's returned in the responses as a property
    { 
     ....
    "hash" : "abcdef....." 
    }


API-url

The API can be accessed from the root of the liveresults webb (for example http://liveresultat.orientering.se/api.php). There is no authentication to use the API

Response-format

All responses are JSON-formatted, all data is cached for 15 seconds so there is NO idea to call the methods more frequent than that.

Runner statuses

Runners in the responses all have a status-field indicating the status of the runner in the competition.
Valid statuses are:
  • 0 - OK
  • 1 - DNS (Did Not Start)
  • 2 - DNF (Did not finish)
  • 3 - MP (Missing Punch)
  • 4 - DSQ (Disqualified)
  • 5 - OT (Over (max) time)
  • 9 - Not Started Yet
  • 10 - Not Started Yet
  • 11 - Walk Over (Resigned before the race started)
  • 12 - Moved up (The runner have been moved to a higher class)

API-Methods

getcompetitions

api.php?method=getcompetitions
Returns a list of competitions that are available

Example-response:
   { competitions : [  
     {   "id" : 10278, 
         "name" : "Demo #1", 
         "organizer" : "TestOrganizer", 
         "date" : "2012-06-01",
         "timediff" : 0},
    { "id" : 10279, 
      "name" : "Demo #2", 
      "organizer" : "TestOrganizer", 
       "date" : "2012-06-02",
       "timediff" : 1,
       "multidaystage" : 1,
       "multidayfirstday" : 10278
    }
   ]}

  • timediff represents number of hours that the timezone of the competition is + or - compared to Central European time (CET)
  • multidaystage and multidayparent are set if the competition is part of a multi day competition. stage refers to the stage of the competition (1,2,4,...,n) and firstday always refers to the competition id of the first stage

getcompetitioninfo

api.php?method=getcompetitioninfo&comp=xxx
Retur information about a single competition

Example-response:
{ "id" : 10278,
"name" : "Demo #1",
"organizer" : "TestOrganizer",
"date" : "2012-06-01",
"timediff" : 0,
"multidaystage" : 1,
"multidayfirstday" : 10278

}
  • timediff represents number of hours that the timezone of the competition is + or - compared to Central European time (CET)
  • multidaystage and multidayparent are set if the competition is part of a multi day competition. stage refers to the stage of the competition (1,2,4,...,n) and firstday always refers to the competition id of the first stage

getlastpassings

api.php?method=getlastpassings&comp=XXXX&last_hash=abcdefg
Returns a list of competitions that are available
Parameters
  • comp - ID for competition
  • last_hash - Hash of last response to only retreive when response have changed

Example-response:
   { "status" : "OK", "passings" : [  
     {   "passtime" : "10:05:23", 
         "runnerName" : "TestRunner 1", 
         "class" : "Men Elite", 
         "control" : 1000,
         "controlName" : "Finish",
         "time" : 23430},
     {   "passtime" : "10:05:22", 
         "runnerName" : "TestRunner 3", 
         "class" : "Men Elite", 
         "control" : 1000,
         "controlName" : "Finish",
         "time" : 23330}
   ],
   "hash" : "abcdef...."}

getclasses

api.php?method=getclasses&comp=XXXX&last_hash=abcdefg
Returns a list of classes in the competition
Parameters
  • comp - ID for competition
  • last_hash - Hash of last response to only retreive when response have changed

Example-response:
{ "status": "OK", 
"classes" : [
         {"className": "Öppen-1"},
         {"className": "Öppen-10"},
         ....
        {"className": "Öppen-8"}], 
"hash": "84b1fdfe67a524a1580132baa174cce1"}

getclassresults

api.php?comp=10259&method=getclassresults&unformattedTimes=true&class=Öppen-1
Returns results for the class
Parameters
  • comp - ID for competition
  • unformattedTimes - if response should include unformattedTimes or if time should be formatted
  • class - the class to retreive results for
  • last_hash - Hash of last response to only retreive when response have changed


Example-response:
{
status: "OK",
className: "Öppen-1",
splitcontrols: [ ],
results: [
{
place: "1",
name: "Frank Sandgren",
club: "OK Klyftamo 1",
result: "72700",
status: 0,
timeplus: "0",
start: ""
},
{
place: "2",
name: "Julia Markendahl",
club: "OK Klyftamo 2",
result: "105200",
status: 0,
timeplus: "32500",
start: ""
},
...
{
place: "13",
name: "Marcus Carlsson",
club: "IF Hagen 5",
result: "665200",
status: 0,
timeplus: "592500",
start: ""
}
],
"hash": "86d84800ced6dca79ece65d23d9a8a35"

getclubresults

+api.php?comp=10259&method=getcclubresults&unformattedTimes=true&club=Klyftamo
Returns results for the class
Parameters
  • comp - ID for competition
  • unformattedTimes - if response should include unformattedTimes or if time should be formatted
  • club - the club to retreive results for
  • last_hash - Hash of last response to only retreive when response have changed


Example-response:
{ 
  "status": "OK", 
   "clubName": "Bengans Orienteringsklubb", 
    "results": [
            {
              "place": "1", 
              "name": "Kalle Karlsson", 
              "club": "Bengans Orienteringsklubb",
              "class": "H21", 
              "result": "231600",
              "status" : 0, 
              "timeplus": "0", 
              "start": 3600000
            },
            {
              "place": "3", 
               "name": "Junia Jönsson", 
               "club": "Bengans Orienteringsklubb",
               "class": "D21", 
               "result": "248700",
               "status" : 0, 
               "timeplus": "17100", 
               "start": 3636000
             }],  
        "hash": "fa6508670a66f7022847645b49b353a6"
}

Last edited May 6, 2015 at 8:52 PM by petlof, version 24

Comments

No comments yet.