How-to build a match page with line-ups/formations
Last updated
Last updated
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)