Seasons
YOUR_TOKENYOUR_TOKENEvery league has an active season and, if available, multiple historical seasons. One of the main features of the seasons endpoints is the ability to retrieve full-season games, (historical) fixtures and statistics. This can be achieved by using the proper includes, which we’ll discuss later in this section.
You can gather an overview of all the historical and current seasons available within your subscription. This section will briefly discuss all the options available to request seasons.
An overview of all the options available:
GET All Seasons: returns all the historical and active seasons available within your subscription.
GET Season by ID: returns the single season you’ve requested by id.
GET Seasons by Search by Name: returns all the seasons that match your search query.
Are you interested in a complete schedule? Then maybe our schedule endpoints are what you’re looking for: Schedule endpoint.
For all the seasons endpoints, the base URL is the same:
https://api.sportmonks.com/v3/football/season
Per endpoint the rest of the URL requires additional information. We will explain this per endpoint.
Requesting seasons
GET All Seasons
Like in the league’s endpoint, you can retrieve all the available seasons within your subscription. This might come in handy if you want to evaluate which historical seasons are available and what their unique id is.
You can do this via the GET All Seasons endpoint.
The URL to get all your season is the same as the base url for seasons. All you have to do is authorize the request with your API token. Check our authentication section for more info.
Let’s take a look together at what the API returns. As you can see, the API returns all the seasons available in the free plan.
You can see the name of the season, the unique season id, the id of the league the season belongs to, the season status (current, pending or finished), the start and end date of the season, and how the season winner is determined
Now that you've requested all the seasons, you also know their unique season id. You can use this id in the second option: GET Season by ID.
Please note that you can also use the seasons include on the league endpoints.
GET Season by ID
This endpoint is useful if you only want information about one particular season. You’ll need to add the season id to your request:
https://api.sportmonks.com/v3/football/seasons/
{season_id}
For example, if you’re only interested in the 2022/2023 season of the Scottish Premiership, your request will be:
Easy isn’t it? You can now request information per season. Now, let’s imagine you’re looking for all historical 2018 seasons within your subscription. How can you achieve this? The GET Seasons by Name endpoint is perfectly suited for this.
GET Season Search by Name
This endpoint returns all the seasons based on your search query. This might come in handy if you cannot find a season or are interested in a specific year. To search on season name, you’ll need to add /search/{search_query} to the seasons base URL:
https://api.sportmonks.com/v3/football/seasons/
search/{search_query}
For example, if you’re only interested in all 2018 seasons, your request will be:
The more complete your search query is, the more relevant response you’ll get.
Adding useful information
As you’ve learnt in the includes tutorial, you can enrich your request with includes. This section will discuss some of the most common requests used on the season’s endpoints.
First, you can find a list of all available includes on the endpoint pages. For the seasons, the commonly used include is fixtures
. This include returns all the fixtures of the requested seasons. You can also request the season statistics or the league related to the season.
For example, if you’re interested in the league, statistics and fixtures of the Scottish Premiership 2022/2023 season, your request will be:
Don’t forget you can use nested includes as well. For example fixtures.participants
to also include the team names in the response.
Selecting and filtering
In our filtering tutorial you’ve learnt how to select specific fields or filter only on the data you’re interested in. By default, our API returns a set of data related to the season. We can imagine you’re not interested in all the season data the API returns. Let’s say you’re only interested in the season name.
We’re going to use the GET All Seasons endpoint for this example.
You can add the &select=
parameter followed by the fields you want. In our case: name
. This results in the below request and response:
Tip: Check our filtering tutorial for more information and tips.
In the next chapter you will learn more about a season’s structure.
Last updated