Markets
After youβve determined if the bookmaker we have is available, you can check for market availabilities. Just like the bookmakers, the market endpoints will help you set up odds properly on your website/application. This endpoint is very useful for administrative purposes to check and structure the marketsβ availability.
This section will briefly discuss all the options available to request markets.
An overview of all the options available:
GET All Markets: returns all the markets available in our football API.
GET Markets by ID: returns markets' information from your requested market id.
GET Markets by Search by Name: returns the markets that match your search query.
For all the market endpoints the base URL is the same:
https://api.sportmonks.com/v3/
odds
/markets
Per endpoint the rest of the URL requires additional information. We will explain this per endpoint.
*Important: Please note that the domain in the URL is odds instead of football.
Requesting markets
GET All Markets
he first option is to request all the markets available in our APIs. With this information, you can determine if the markets youβre interested in are available.
The URL to get all markets is the same as the base URL for markets. 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 at what the API returns. You can see the id of the market, the legacy id (what the market id was in our old API), and the market's name. You can also see the indication if the winning odds is calculated during/after the match.
Not all markets we cover have winning odds calculations. Every market has a flag marking whether you can expect winning odds for it.
Now youβve gathered an overview of the available markets with their unique, you can use this id on the Markets by ID endpoint.
GET Markets by ID
This endpoint returns market' information from your requested market id. All youβve to do is add the unique id of the market you want.
https://api.sportmonks.com/v3/odds/markets
/{market_id}
For example, if youβre interested in the Alternative match goals market (id: 5):
GET Markets by Search by Name
This endpoint returns all the markets based on your search query. This might be handy if you cannot find a market. To search on market name, youβll need to add /search/{search_query}
to the markets base URL:
https://api.sportmonks.com/v3/odds/markets
/search/{search_query}
For example, if youβre only interested in markets with βalternativeβ in the name, your request will be:
The more complete your search query is, the more relevant response youβll get..
Adding useful information
There are no include options available for the market endpoints.
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 market. We can imagine youβre not interested in all the market data the API returns. Letβs say youβre only interested in the name.
You can add the &select=
parameter followed by the fields you want. In our case: name
. This results in the below request and response:
Check our filtering tutorial for more tips and tricks.
Last updated