Lineups and formations
One of the most vital parts of a well-designed football application is displaying lineups and formations.
You can use the formations
include to obtain the formations of the participants:
It’s great to combine this with the lineups
include:
Bench and sidelined
You can find all bench players as well. You need to use lineupType:12 to receive these players.
Another great feature is to find all sidelined players. When using the include sidelined.sideline you will receive all players with suspensions and injuries. With the aforementioned include, you can also find more specific information about the type of suspension, like a doping ban or whether a player is on duty with his national team.
Creating the Lineup
Before we fill in the formation, let us first explain formation positions. Players have different formation_positions. So for example, one player has the player’s formation_position: 1, another has formation_position: 2, etc. Formations are described using numbers that correspond to positions on the field, starting from defence (right to left), then midfield (right to left), and finally, attackers (right to left). For example, in a 4-3-3 formation, the goalkeeper will take number 1, and the defenders will take number 2, 3, 4, 5. Formation numbers 6, 7, and 8 represent the central midfielders. Self-evident, formation numbers 9, 10 and 11 are representing the attackers.
You can use the formation numbers in combination with the lineup formation to display formations. The formation number is by order of the lineup formation.
So, for example, formation 4-3-3: Formation number 1: Keeper Formation number 2: Right back Formation number 3: Central defender Formation number 4: Central defender Formation number 5: Left back Formation number 6: Central midfielder Formation number 7: Central midfielder Formation number 8: Central midfielder Formation number 9: Right winger Formation number 10: Striker Formation number 11: Left winger
You can add the players to the grid according to their formation_position.
Lineup statistics
Now you have the complete lineup and formation of the teams in the fixture. If you’re interested, you can also retrieve the statistics of the players and filter only to include players that were in the starting eleven:
Are you interested in more information about statistics or filtering? Check our below tutorials.
Predictive Line-ups
Another cool feature that has to do with the line-ups is predictive line-ups. In API 3.0, getting a line-up before the definitive line-up is released is now possible. When you use the “Fixture By ID” endpoint with the lineup include, you will see a line-up way before the actual line-up is released.
By using the include metadata, you can find the lineup_confirmed type. The type will be false if the club has yet to release the line-up. This is when we show a predicted line-up based on previous line-ups in games, suspended and injured players.
Once the team/club officially releases their line-up, it will be set to true. Then the line-up we offer should reflect the final line-up as it is during the game.
Last updated