Tips and tricks

Fixture score

Are you interested in the score of the fixture?

You can retrieve the scores of a fixture by using the &include=scores parameter when calling the API endpoint for that fixture.

The scores will be returned in the response, along with a description and type to help you understand when the goals were scored, for example, 1ST_HALF and 2ND_HALF.

To display the latest scores for a game, including any extra time that may have been played, use the CURRENT indicator.

Here’s an example of how to retrieve the scores for a fixture:

https://api.sportmonks.com/v3/football/fixtures/18804545?api_token=YOUR_TOKEN&include=scores

Fixture events

You probably know that you can use the events include to obtain all fixture events like goals, substitutions and cards, but did you also know you can enrich this data?

Let’s take a look at some features you might have missed.

Add player information

Interested in more information about the players related to the fixture event? Use the .player include for detailed player info:

https://api.sportmonks.com/v3/football/fixtures/18804545?api_token=YOUR_TOKEN&include=events.player

The request also returns player information you might not need. You can use the select option only to retrieve the player info you want:

https://api.sportmonks.com/v3/football/fixtures/{fixture_id}?api_token=YOURTOKEN&include=events.player:image_path

More info can be found in our select tutorial.

Extra event info

The events.subType include is a powerful feature that provides additional information about a specific entity belonging to a particular type in the Sportmonks' Football API. It allows you to access more detailed data related to an event, such as goals, that fall under a certain type. For example, in the case of events, the type_id can be "GOAL" (id: 14), and the sub_type can provide specific details about the goal, like whether it was scored with the right-foot or the-left foot or the head of the player.

When fetching events, you can use the following parameters: &include=events.subType This will return the events.subType information related to each event, allowing you to access additional details about the events based on their types.

Let's consider an example to illustrate how to utilise the events.subType include in the API request:

https://api.sportmonks.com/v3/football/fixtures/18804545?api_token=YOUR_TOKEN&include=events.subType

In this example, we retrieve a list of events, and by including the events.subType, we gain access to the additional information associated with each event's type.

The response will contain the relevant events.subType details for each event, providing more context and specificity about the events within the result set.

Extra fixture information

The fixture and livescore endpoint return basic information by default. You can use the metadata include if you’re interested in information about the pitch, team colours, formations, if the lineup is confirmed or not and, when available, a fixture hashtag.

​​https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=metadata.type

The recommended way to obtain formations is via the formations include:

​​https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=formations more info can be found in our Lineups and Formations tutorial.

Including .type is not recommended as an include on any endpoint. Types are used throughout the entire API. We recommend retrieving all types from the types endpoint and storing them in your database or other data structure. Only include the type if no other option is available or when testing the API.

Extra player information

Are you interested in building a complete player profile? With our Player by ID endpoint, you can do just that, but did you know that you can also obtain information about the preferred foot of players? Use the metadata for more info about a player:

https://api.sportmonks.com/v3/football/players/580?api_token=YOUR_TOKEN&include=metadata.type

Including .type is not recommended as an include on any endpoint. Types are used throughout the entire API. We recommend retrieving all types from the types endpoint and storing them in your database or other data structure. Only include the type if no other option is available or when testing the API.

Extra topscorer details

Often players make transfers during the transfer winter period. Sometimes, they transfer to the same league. How do you know for which team they scored a certain number of goals?

When using the topscores include on stages and seasons, you can now use the nested topscorers.topscorer include. This include shows more information about how the record was established. For a player, it shows for which individual teams the player scored goals which counted towards the total.

https://api.sportmonks.com/v3/football/seasons/19734?api_token=YOURTOKEN&filters=seasonTopscorerTypes:208&include=topscorers.topscorer

Last updated