Race Data API is an event based Web API for subscribing to race data from Swedish Trotting Association and Swedish Gallop in XML format. Data is delivered in near real time, and includes race cards with past performances, race results, and more.
That the API is event based, means that you don’t request specific data from Race Data API. Instead, you will listen for data to be sent out whenever an event happens. Most of the events are based on added or updated data in the Horse Sports System (HSS). Changes there will trigger up-to-date data to be sent out to subscribers. Other types of events include time based events, or events that are triggered from different devices when races are run on the tracks.
Since you cannot request specific data from Race Data API, you should take care to store the data on your side after you receive it. This will make sure you always have the latest data on your side.
Data can be classified into two categories; durable and transient. Most of the data is durable. This means that the data will be buffered on our side if you don’t pick it up immediately after it has arrived. And after you receive the data, it should be stored on your side. Transient data is time based data that only has a value at the moment in time when it is delivered. Examples of transient data are countdown timers that every second send messages with time remaining until parade or start.
Durable and transient data are delivered by two different endpoints. Durable data is delivered by means of long polling. This means you will make continuous requests to the API, and for each request hold the connection until the API either returns a message with data, or an empty message. Transient data is time sensitive. In order to minimize latency, it is delivered over WebSockets. transient data will be lost if you are not connected and listening when the data is sent.
You can use any programming language that supports Web API and WebSockets to access Race Data API, and you don’t need to have an active subscription to begin. To start developing and testing your code right away, you can use our Docker based API simulator.
You can feed your own data into the simulator, or you can use data that we have recorded from actual races. The recorded data has been cleaned of any personal information, so it is safe to use for development and testing.
We can also help set up a simulator in the cloud for you. Please contact sportdatasupport@travsport.se if you want us to help you.
We have sample code in curl, Node.js, Java and Python. Even if you don’t use one of these tools or languages, looking at our sample code should help you understand how to write the code in your language. Our code samples are still under development, and we don’t have complete set of sample code for each of the above languages today, but we will be adding more. Let us know if you miss anything.
Before using the production API, you need to have a legal agreement in place with Swedish Trotting Association and/or Swedish Gallop. Please contact sportdatasupport@travsport.se for more information.
If you find any errors in the documentation or sample code, please send an email to sportdatasupport@travsport.se and explain what you have found. Then we will attempt to correct it.