Selecting and filtering
Thanks to the API flexibility, you can select specific fields and filter simultaneously!
Let’s continue with our events example from the last section: we want all the goal and substitution events:
This time we’ve used the include events.type to have the name of the event type included in the response. More information about this can be found in our nested include tutorial.
Now, the events include contains a lot of information we’re not interested in. Frankly, we’re only interested in the name of the players related to the event and the minute the event occurred. As you’ve learnt, we can select all the fields on the base entity.
In our example, the events entity. We need the “player_name”,
“related_player_name”
and “minute”
field. This results in the following steps:
Add the include:
&include=events
Determine the fields you’re interested in:
“player_name”,
“related_player_name”
and“minute”
field.Select the fields:
&include=events:player_name,related_player_name,minute
The above steps result in the following request:
Now, add the filter from the previous filter request: &filters=eventTypes:18,14
Please note that if you also want the name of the event type you need to add the events.type
include as well.
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=events:player_name,related_player_name,minute;event.type&filters=eventTypes:18,14
Last updated