Retrieving Tournament Series Predictions#
In the following example we'll show how to retrieve information for the NBA Basketball Playoff Series.
Related APIS
Method | Description | Availability |
---|---|---|
GET |
/{sport}/v2/leagues | All Leagues |
GET |
/{sport}/v2/series_simulations | NBA NCAAMB |
In order to load tournament info via the API, you will need to know the UUID of the tournament. Start By querying the tournaments endpoint and get the uuid for the 2021-22 NBA Playoffs. We'll filter by this season and only ask for the NBA league (uuid 634e7f95-8209-4846-beb5-cf8555f99237
which can be found by querying /basketball/v2/leagues
)
GET https://api.quarter4.io/basketball/v2/tournaments?count=100&season.season=2021&league.uuid=634e7f95-8209-4846-beb5-cf8555f99237
This result contains a list of tournaments. Locate the 2021 NBA Playoffs and note the uuid
. In this case it's 9510e881-0fad-4e9e-9455-ca27e371ce0c
.
So you can now retrieve additional information for just that tournament, such as the rounds and their related series ids:
GET https://api.quarter4.io/basketball/v2/tournaments/9510e881-0fad-4e9e-9455-ca27e371ce0c?include=rounds
The list of series for each round is in the above result under included[].relationships.series[]
.
You can then use that result to query each series and include the simulatedPicks
:
GET https://api.quarter4.io/basketball/v2/series/cc3287a6-2564-4a04-9e96-2a6dd71c5c87?include=simulatedPicks
The series will have the known home and away team info, current status, events and more. The simulatedPicks
entry (under included[]
in the above result) has the information for the series prediction:
{
"id": "\/basketball\/v2\/series_simulations\/762558bf-8327-44b4-82fa-73811350fda0",
"type": "SeriesSimulation",
"attributes": {
"teamSeed": 4,
"teamConferenceRank": 4,
"opponentSeed": 5,
"opponentConferenceRank": 5,
"teamWinProbability": 0.824583,
"teamWinProbabilityIfWin": 1,
"teamWinProbabilityIfLose": 0.71136,
"opponentWinProbability": 0.175417,
"opponentWinProbabilityIfWin": 0,
"opponentWinProbabilityIfLose": 0,
"gamesPlayed": 5,
"finalResultProbability": {
"4-0": 0,
"4-1": 0,
"4-2": 0.392264,
"4-3": 0.432319,
"0-4": 0,
"1-4": 0,
"2-4": 0,
"3-4": 0.175417
},
"uuid": "762558bf-8327-44b4-82fa-73811350fda0",
"homeTeamUuid": "05c5fe22-3363-424c-b8a7-f924491940b7",
"awayTeamUuid": "974d3b03-6509-40a7-a479-7326d8741a16",
"teamUUID": "05c5fe22-3363-424c-b8a7-f924491940b7",
"opponentUUID": "974d3b03-6509-40a7-a479-7326d8741a16",
"winnerUuid": "05c5fe22-3363-424c-b8a7-f924491940b7",
"loserUuid": "974d3b03-6509-40a7-a479-7326d8741a16"
},
...snip...
The series simulation has team and opponent attributes, which you can relate back to the series home and away team via comparing the UUIDs.
The simulated picks will update as the rounds progress and actual results are updated.
For more information on the relation mapping and JSON:API format see https://jsonapi.org