Welcome to our how-to guide about creating a match page that is filled with various events and statistics. This is a follow-up on the how-to build your livescore website guide. The livescore page only shows the live score of the match and sometimes the bigger events such as goals, substitutions, and cards. For basic knowledge about livescores, includes, and nested includes please see our tutorials.
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 on our Developer Tools Guide.
At SportMonks we offer the following events:
Goals
Red and yellow cards
Substitutions
VAR
Extra time
Score in between Half and Final time
Corners
For match statistics, think about anything that can happen during a match such as: The number of shots, passes, attacks, fouls, corners, offsides, yellow/red cards, saves, substitutions, goal attempts, penalties, injuries, and many more. Player statistics are all the relevant statistics regarding a player, such as the number of goals scored, how many fouls he made, and the number of cards received, etc.
The standard events
include consists of goals, substitutions, and cards. There is also the include called corners and many more. For a full list of the possible includes see our API reference guide.
Player and match statistics do not have endpoints, but instead can be evoked with includes.
Match statistics use the include stats
.
Player statistics use the includes lineup
and bench
.
Lineup only gives us the 11 starting players, while we want everyone from the bench as well.
Since this is about a single match page with various events and stats, we will need the specific fixture ID. Henceforth, we’ll work with the fixtures by id endpoint.
It’s also possible to include both stats, lineup and bench includes in the same request, but expect a lengthy response in that case.
You can compare two teams' past results against each other. This is often used to see how one team performs against another. This endpoint is simply called head2head.
In this how-to guide, we’ll show you how to request events data, player and match statistics, and head2head data:
It’s also possible to use the stats
and lineup
includes in the head2head endpoint, in case you want to show even more in-depth data about the history of these matches.
Here, we can see the detailed player statistics of the player named S. Bain. Apart from standard player information such as which team he belongs to, what his player id or position is. We can see the total number of shots, goals, fouls, cards, passing, dribbles and duels. There’s also an ‘other’ tab with even more information, but we won’t go into detail for that one.
As its name suggests, we can see the team statistics of the home team. We can see the number of shots, passes, attacks, and a plethora of other data of the entire team.
Events show goals, cards, and substitutions and at which exact minute this happened. So, we can see that in the 14th-minute player S. Rosted scored the 0-1 and got an assist from J. Lindstrom.
Player J. Lauridsen got substituted for M. Kallesoe in the 25th minute. And finally, player M. Schwabe got a yellow card in the 91st minute.
Now for the head2head, you’ll probably get a huge response because head2head is every single encounter the two teams have had. The most recent ones will be on top of the list. General information about each match will be given, such as its fixture id, season id, winner of the match, the final score, date of when the game was played, how many minutes the match was, and much more.
In case, you want to see the lineups of players who played at the time, you can simply add the include lineup,bench
.
For an overview of field descriptions, you can refer to our statuses and definitions.
Welcome to our guide about building a team page that shows the squad of a team for a specific season, as well as the seasonal statistics of the team. A squad is the entire group of players related to a team in a particular Season.
We’ll show you three different endpoints that you can work with to get the seasonal statistics and squad data. Afterward, we’ll show you a basic implementation process in order to build the team page. We'll show you example requests of the Scottish Premiership team Celtic of the 20/21 season. This league is included in our free plan, so feel free to make the requests yourself.
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 on our Developer Tools Guide.
To get all players of a squad and squad stats, you can opt to only show the current season, but if you value historic data, then you might as well show past iterations of the squad. It’s common to show all the members of the squad on one page for a nice overview of all their statistics, such as:
Player names
Playtime
Number of appearances in matches
Number of times substituted in or out
Number of goals scored, assists given
Number of cards received
And many more!
You can have statistics about almost anything in sports. So, it’s up to you to decide what statistics you want to show to your users. At SportMonks we offer you highly detailed season statistics per team such as:
Win-loss record
Number of attacks, fouls, cards, saves
Clean sheets
Number of goals scored between minute 0 and 15, or between minutes 75 and 90
Ranking and how many points they have
Average time for first goal scored/conceded
Average number of goals per match/win
And much more!
As mentioned before, we will discuss three different endpoints:
Team by id endpoint with some includes
The first two request the individual player statistics of all the players in a squad, but in different ways, while the last one requests the statistics of the entire squad for either all the seasons for historical data or just for one specific season.
We’ll show you how to work with all three endpoints.
The squad by team and season id endpoint requires you to simply fill in the ids of the season and team you want. While the team by id endpoint has you fill in the team id and filter on season id.
Note that for the get squad by season and team id includes, we added the includeplayer
for more detailed player information. For team by id, we enriched the request with nested includes and filtered on season id.
Probably the simplest of them all. This request also uses the team by id endpoint but the difference is that we use the include stats
:
This request also filters on the season id that you’re interested in. This is optional as some web applications also like to show historical team statistics. In this how-to guide, we’ll work with the current season id.
Since the two requests return the same data, we’ll only show you the output of the squad by team and season id endpoint.
Let's look at Celtic's captain Scott Brown. There’s a lot of information about his stats, such as minutes played, times he got substituted out, duels won, clean sheets, etc.
Lastly, there’s detailed information about the player, such as his name, height, weight, date of birth, etc.
Now for the team by id endpoint with the stats
include:
Without a filter this request will give you all seasons stats that Celtic has played in, starting chronologically from the first to the most current season.
For convenience, we once again show you the statistics of their current season. The request contains lots of detailed information for you to use as you please.
Most websites allow their users to click on a specific match in order to show the corresponding match page. These match pages are often filled with big events, lineups, various statistics about the players, the match itself, and sometimes even the coach.
In this how-to guide, we’ll show you how you can use SportMonks’ API data in order to create these match pages.
In this guide, we'll show you how to correctly build a match page that shows the line-up/formation of the teams. This is one of our most frequently asked questions. So, we decided to create a how-to guide that will show you exactly how you can load the line-ups/formations. This guide will walk you step by step, from requesting the line-up data to putting players in their correct line-up grid.
You are going to need the following tools:
SportMonks API token
Postman (optional)
You can find a link to another article where we discuss the tools in-depth on our Developer Tools Guide.
There are various ways to get fixture IDs such as:
Use fixtures
include on the season by id endpoint
And many more
For this guide, we’ll go with the following fixture id: 16924631 (Manchester United - Tottenham Hotspur). This fixture id is also the default fixture id in our Postman collection.
Because we want the line-up from both teams we add the includes lineup
and bench
. Furthermore, it's interesting to know which players cannot play due to an injury or suspension. You can add the sidelined
include for this as well. If you want the full name of players, please refer to Step 5.
A snippet of the response:
Many of our users stop at this step, but some want to visually display the formation. In step 3 we’ll discuss how you can do that.
First, we want to know what formation, both teams used. Luckily, this information is included in the default response you get from our fixtures/livescores endpoints. For example:
Before we fill in the formation, let us first explain formation positions.
In the example response from step 2, you could have noticed that the player's formation_position: 1
. Our API slots formations from right to left, meaning that the visitorteam_formation
will look like this for a classic 4-3-3 formation:
So, in this case, we have:
Alright, back to filling in our formation. The visitor team used a 4-3-3 formation, while the visitor team used a 4-2-3-1 formation. So their respective formations will look like this:
You can follow the same principle for the away team.
And that is how you can fill in the correct formation with our API. For any further questions, you can simply contact us by email at support@sportmonks.com
The API will return the name of the player with the first name as initial and last name written fully e.g. H. Kane, instead of Harry Kane.
In other cases, the player has a common name that isn’t the same as their actual full name. By using the nested include lineup.player
, we can request all the player data we would need, including all their names.
We can see the various names and more specific player info of player Harrry Kane with this request.
This marks the end of this how-to guide. We hope you have gotten a better understanding of how our API sorts the line-ups and how you can put it in the right formation. See you in the next how-to guide!
Formation Number
Outcome
1
Keeper
2
Right-back
3
Central defender
4
Central defender
5
Left-back
6
Right central midfielder
7
Central midfielder
8
Left central midfielder
9
Right-winger
10
Central forward
11
Left-winger
1 (Goalkeeper)
Formation_position: 1 (Hugo Lloris)
4 (Defenders)
Formation_position: 2 (Serge Aurier)
Formation_position: 3 (Davinson Sánchez)
Formation_position: 4 (Eric Dier)
Formation_position: 5 (Sergio Reguilón)
3 (Midfielders)
Formation_position: 6 (Moussa Sissoko)
Formation_position: 7 (Pierre-Emile Højbjerg)
Formation_position: 8 (Tanguy Ndombélé)
3 (Attackers)
Formation_position: 9 (Érik Lamela)
Formation_position: 10 (Harry Kane)
Formation_position: 11 (Heung-Min Son)