How-to build a schedule page

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).

Step 1: Assemble the tools

You’re going to need the following tools:

  • Sportmonks API token

  • Code editor (Visual studio used in examples)

  • Postman (optional)

Step 2: Request the rounds of the English Premier League

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:{API_TOKEN}&include=rounds

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:{API_TOKEN}&include=rounds.fixtures

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:{API_TOKEN}&include=stages.rounds.fixtures.localTeam,stages.rounds.fixtures.visitorTeam

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.

Step 3: Request the Champions League 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.{API_TOKEN}&include=stages

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

Requesting the fixtures

While, yes, we can use the nested include.fixturesagain. 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:{API_TOKEN}&include=stages.rounds.fixtures.localTeam,stages.rounds.fixtures.visitorTeam

Instead, we will use the get stage by id endpoint with fixtures as include:{API_TOKEN}&include=fixtures.localTeam,fixtures.visitorTeam

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:{API_TOKEN}&include=groups.fixtures