Welcome to our how-to guide about building a livescore website. Livescore websites are one of the most popular applications for sports data. But, what exactly is a livescore website?
As its name suggests, livescore websites are website applications primarily focused on showing the livescores of sports matches. Furthermore, livescores are updated in real-time. So, a football livescore website should, for instance, tell you the real-time live score, minute of the match, current score, and its starting time.
You are going to need the following tools:
Sportmonks API token
Code editor (Visual studio used in examples)
Postman (optional)
You can find a link to another article where we discuss the tools in-depth in our Developer Tools Guide.
Now that we have all our tools, we can start planning what we want to show our audience. Which leagues pique your interest? Do you want to show as many leagues as possible? Or do you only want to show specific leagues, like the English Premier League?
These are all things to consider, but you have to make sure that the leagues you choose are available in your plan. See our coverage page to see which leagues are included per plan. You can request all the leagues in your current plan via our get all leagues endpoint.
If there are no ongoing matches in your plan, the livescore API will return nothing back.
Now that you have decided on which leagues you would like to show, the next step is to choose what data would be useful to offer.
Most livescore websites show:
Date of the match
What time the match starts
The home and away teams
Status of the game: first half, half time, match has ended, minute by minute, etc.
Live score
Events such as goals, cards
Team logos, league logos, country flag
All of this seems like a lot of data to request but fear not because our livescore API will be able to return all of that data in a speedy and accurate manner. Moreover, the API is highly flexible, since it only returns the data you requested.
If you require more match data such as lineups and match statistics, please refer to the how-to build a match page with events and statistics.
Our API 2.0 has two endpoints for getting livescores:
The first request will give you all the fixtures of the current day. While the second one will provide you with all the fixtures that are currently in-play.
In the livescores/now endpoint, the fixtures will be available 15 mins before the match has started and 15 mins after it has ended.
In this how-to guide, we’ll go with livescores/now endpoint.
Now that we have the request ready, it’s time to enrich the URL with various includes, based on the choices you made in step 3.
An example of a very common request is to include home and visitor teams, goals scored, substitutions, and yellow/red cards.
For convenience’s sake, we have assembled these three includes into one include called events
. However, if you only want to show goals and cards, you can simply replace events
with goals
and cards
.
For a full list of possible includes on livescores, see our API reference guide.
Ultimately, you will be the one to build the livescore website, so feel free to add whatever includes you want. You can add as many or as little as you would like.
For example, we’ll analyze a match (fixture id: 16475287) in the Scottish Premiership between Celtic (team id: 53) and Hamilton Academical (team id: 338). Below you can find the response with its events. We used the livescore request at the time, but you can refer to the fixture by id request for the same output:
Events will show all the goals, cards, and substitutions. Here we can see that player S. Martin got a yellow card in the 17th minute and that the first goal was made by O. Edouard in the 20th minute for Celtic.
Let's say, we want to make a dedicated page just for the English Premier League (league id: 8) on our livescore website, but our plan has over 600 different leagues. On Saturdays, there are a lot of active games. However, we only want the data pertaining to the English Premier League (league id: 8), so we can filter out everything else. We have discussed filtering in a previous tutorial. An example of such a request with filter:
In the example above, we request all the livescores that are in play, but only for the English Premier League (league id: 8). The main advantage is that the return of data is many times faster than when you request everything available in your plan.
By the same logic, you can also specify specific fixtures:
Now, it will only show the fixture with fixture id 16475285.
Showing the national flag of a league is always handy. You can request the country flag with a nested include:
Sportmonks’ livescore API provides you with the fastest and most reliable data possible, allowing you to create your dream livescore website. Our APIs are so fast that the provided data will show events that didn’t even happen on live television yet!
In this how-to guide, we’ll walk you through the steps of making standard and advanced livescore requests and what tools you need to build a livescore website.
We recommend you submit your requests with Postman since we have already prepared the request for you there! Hit the button below to import our football API collection.
Welcome to the how-to build a season fixture schedule guide. This is a follow-up on the rounds, groups and stages tutorial. Rounds, groups and stages are, in fact, the building blocks of a season schedule. Now, in this how-to guide, we will use those building blocks to create a season fixture schedule. This schedule will show all the fixtures yet to come. We’ll show you how to create a season fixture schedule for the English Premier League (league id: 8) and one for the Champions League (league id: 2).
You’re going to need the following tools:
Sportmonks API token
Code editor (Visual studio used in examples)
Postman (optional)
We chose the English Premier League because it’s a domestic league without any different stages or groups, but it does have multiple rounds across their season. That’s why we’re going to request the rounds of the English Premier League season 20/21 (season id: 17420). We’ll use the following URL:
Now that we have all the English Premier League rounds, we want to check which fixture ids are associated with each round. Here are several examples of correct requests:
Request 3 is used when you want to request the fixtures of a specific round id.
In this example, the EPL only has one stage, but other leagues may have multiple stages. In that case, we suggest you use the following request:
Your request may be too big, if that's the case, pagination will kick in. You can refer to our Pagination tutorial for more information
Our Football API 2.0 has now given you the data of every round of the English Premier League and every fixture per round. This is the data you need to create the seasonal fixture schedule of the English Premier League.
In step 3, we’re going to show you how you can do the same for the Champions League, which will be significantly harder because the Champions League works with rounds, groups and stages.
Let's take a look at the Champions League season 20/21 (season id: 17299). We start from a top position. We first request all the stages and can then work-out all the fixtures per stage and group.
We can see that the Champions League has the following stages:
Preliminary round - Semi-finals
Preliminary round - Final
1st Qualifying round
2nd Qualifying round
3rd Qualifying round
Play-offs
Group Stage
8th Finals
Quarter-finals
Semi-finals
Final
While, yes, we can use the nested include.fixtures
again. This would result in a huge, hard to read response. You can see for yourself with the following request that will give you an overview of everything about the Champions League:
Instead, we will use the get stage by id endpoint with fixtures as include:
This will request all the fixtures of the preliminary round - semi-finals (stage id #77447942). You can repeat this step for all the other stages, except for the group stages.
Because there are eight groups (A-H), we want to subdivide this stage (stage id #77448760) into their respective groups. We use the nested include groups.fixtures
:
This request will give you the standings too for each respective group and all the fixtures of that group.
The Champions League also have a lot of knock out fixtures. The team who has the better result over two matches will go to the next stage. But how do you know what the overall result is?
You can use the aggregate
include on fixtures level. This will show you the overall result between fixtures. Let's take a look at an example: Juventus vs Porto (second leg).
As you can see in the response, the overall result was 4-4 and the winner of this match is FC Porto(id:652)
. When you include aggregate.fixtures
it will also include the information about the first fixture.