hasOdds

In this tutorial, we’re going to discuss the HasOdds filter. A field called has_odds has been implemented on Fixture entities, marking whether a Fixture has odds available in our database.

What does the filter do?

The filter does exactly what you think it does. It shows if the fixture has odds.

It can be applied to all fixture entities.

How to apply the filter?

You can apply the filter as follows:

&filters=havingOdds

What if I want the opposite result?

You can also switch the value of the boolean to check for fixtures that don’t have odds. Use &filters=havingOdds:false to get the exact opposite result. The fixtures without odds will be included in the response you receive from our API.

Why would I use the hasOdds filter?

You can separate the fixtures that do and don’t have odds. You don’t have to create your own filter and keep refreshing. You can now use one (or two) requests to separate the fixtures and get the ones you need.

Make the requests and evaluate the response

So you can filter both ways. You can find all fixtures with odds, or you can find all fixtures without odds. Let’s look at an example of how to do this exactly.

https://api.sportmonks.com/v3/football/livescores/inplay?api_token=YOUR_TOKEN

Now we are simply adding &filters=havingOdds, and we will receive all live fixtures with odds.

https://api.sportmonks.com/v3/football/livescores/inplay?api_token=YOUR_TOKEN&filters=havingOdds

Let’s find out about the opposite. The request is done at exactly the same time, but the response shows different matches.

https://api.sportmonks.com/v3/football/livescores/inplay?api_token=YOUR_TOKEN&filters=havingOdds:false

Last updated