How-to build a team page
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 22/23 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
- 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:
These first endpoint returns the individual player statistics of all the players in a squad, the second endpoint returns statistics of the team.
We’ll show you how to work with the 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.
Teams by ID
Team Squad by Team ID and Season ID
"last_played_at": "2023-02-26 15:00:00",
"name": "Team Wins",
// And more
Since the two requests return the same data, we’ll only show you the output of the GET Team Squad by ID and Season ID endpoint including statistics.
Let's look at Cody Gakpo’s World Cup stats. There’s a lot of information about his stats, such as minutes played, times he got substituted out, duels won, clean sheets, etc.
Now for the team by id endpoint with the
statisticsinclude, this request returns all the season with statistics. Please check out team statistics tutorial to learn how to filter on specific data.
To add more to your team page you could add league standings and topscorer standings for the team you prefer.
There is a lot more information regarding their standings that you can opt to use for your application.
You can also add the top scorers' standings to your page. For that, we have created the topscorers endpoint.
By using these endpoints, you can add more depth to your team page.