Retrieving Pre-Game Player Predictions#
In the following example you will retrieve all the upcoming player performance predictions for the next NFL game.
Related APIS
Method | Description | Availability |
---|---|---|
GET |
/{sport}/v2/events | All Leagues |
GET |
/{sport}/v2/players | All Leagues |
GET |
/{sport}/v2/performances | All Leagues |
GET |
/{sport}/v2/{event_uuid}/performances | All Leagues |
Start By querying the /{sport}/v2/events
endpoint for the next available game in the NFL. Filter by league.uuid
, startDate
and order
. Also add the properties[]=uuid
to only return the uuid
for each event as you will need that in the next step:
GET https://api.quarter4.io/american-football/v2/events?startDate[after]=now&order[startDate]=asc&league.uuid=38344248-9889-11eb-a8ab-0647cdb505d0&page=1&count=1&properties[]=uuid
This result contains a list of upcoming events (here limited to 1 due to the count
query parameter). For example:
{
"links": {
"self": "\/american-football\/v2\/events?count=1\u0026league.uuid=38344248-9889-11eb-a8ab-0647cdb505d0\u0026order%5BstartDate%5D=asc\u0026properties%5B%5D=uuid\u0026startDate%5Bafter%5D=now\u0026page=1",
"first": "\/american-football\/v2\/events?count=1\u0026league.uuid=38344248-9889-11eb-a8ab-0647cdb505d0\u0026order%5BstartDate%5D=asc\u0026properties%5B%5D=uuid\u0026startDate%5Bafter%5D=now\u0026page=1",
"last": "\/american-football\/v2\/events?count=1\u0026league.uuid=38344248-9889-11eb-a8ab-0647cdb505d0\u0026order%5BstartDate%5D=asc\u0026properties%5B%5D=uuid\u0026startDate%5Bafter%5D=now\u0026page=256",
"next": "\/american-football\/v2\/events?count=1\u0026league.uuid=38344248-9889-11eb-a8ab-0647cdb505d0\u0026order%5BstartDate%5D=asc\u0026properties%5B%5D=uuid\u0026startDate%5Bafter%5D=now\u0026page=2"
},
"meta": {
"totalItems": 256,
"itemsPerPage": 1,
"currentPage": 1
},
"data": [
{
"id": "\/american-football\/v2\/events\/d2554158-f1fe-4fa2-97b5-bf7f076979d4",
"type": "Event",
"attributes": {
"uuid": "d2554158-f1fe-4fa2-97b5-bf7f076979d4"
}
}
]
}
To retrieve all the player predictions related to the event you can query the /{sport}/v2/events/{event_uuid}/performances
endpoint using the event's uuid:
GET https://api.quarter4.io/american-football/v2/events/d2554158-f1fe-4fa2-97b5-bf7f076979d4/performances
{
"links": {
"self": "\/american-football\/v2\/events\/d2554158-f1fe-4fa2-97b5-bf7f076979d4\/performances"
},
"meta": {
"totalItems": 68
},
"data": [
{
"id": "\/american-football\/v2\/performances\/e6829419-b7b1-3cea-9e4f-047e93fcedae",
"type": "Performance",
"attributes": {
"uuid": "e6829419-b7b1-3cea-9e4f-047e93fcedae",
"passingAttempts": null,
"passingCompletions": null,
"passingYards": null,
"passingTouchdowns": null,
"passingInterceptions": null,
"rushingAttempts": null,
"rushingTouchdowns": null,
"rushingYards": null,
"rushingLongest": null,
"receivingReceptions": 4.25,
"receivingYards": 55.224,
"receivingLongest": 26.678,
"receivingTouchdowns": 0.58,
"defenseCombined": null,
"defenseInterceptions": null,
"totalReturnsYards": null,
"defenseSacks": null,
"fieldGoalsMade": null,
"fieldGoalsAttempts": null,
"fieldGoalsLongest": null,
"fieldGoalsYards": null,
"puntsAttempts": null,
"puntsYards": null,
"defenseTackles": null,
"defenseAssists": null,
"receivingAvgYards": 12.994,
"receivingYardsAfterCatch": 20.984,
"puntsLongest": null,
"passingLongest": null,
"passingCmpPct": null,
"passingSacks": null,
"passingSackYards": null,
"rushingAvgYards": null,
"fumblesFumbles": null,
"puntsHangTime": null,
"puntsInside20": null,
"puntsReturnYards": null,
"puntsNetYards": null,
"puntsAvgYards": null,
"puntsAvgNetYards": null,
"puntsAvgHangTime": null,
"puntsTouchbacks": null,
"defensePassesDefended": null,
"defenseTloss": null,
"defenseReturnsYards": null,
"puntReturnsAvgYards": 0,
"puntReturnsYards": 0,
"puntReturnsLongest": 0,
"puntReturnsNumber": 0,
"kickReturnsAvgYards": 0,
"kickReturnsYards": 0,
"kickReturnsLongest": 0,
"kickReturnsNumber": 0,
"kickReturnsTouchdowns": 0,
"kickReturnsLongestTouchdown": 0,
"rushingYards100Plus": null,
"passingYards300Plus": null,
"passingTouchdowns3Plus": null,
"startingProbability": null,
"predictAsStarter": false
},
"relationships": {
"player": {
"data": {
"type": "Player",
"id": "\/american-football\/v2\/players\/297e095e-9ba0-4afa-b6d3-585fb05511ad"
}
},
"event": {
"data": {
"type": "Event",
"id": "\/american-football\/v2\/events\/d2554158-f1fe-4fa2-97b5-bf7f076979d4"
}
},
"team": {
"data": {
"type": "Team",
"id": "\/american-football\/v2\/teams\/499a829d-e18d-4b3a-81a8-7aad418fef95"
}
}
}
},
...snip...
Or you can request the entity using the /{sport}/v2/performances
endpoint as the event.uuid
along with any other filters you may wish to use::
GET https://127.0.0.1:8000/american-football/v2/performances?event.uuid=d2554158-f1fe-4fa2-97b5-bf7f076979d4&player.uuid=297e095e-9ba0-4afa-b6d3-585fb05511ad
For example:
{
"links": {
"self": "\/american-football\/v2\/performances?event.uuid=d2554158-f1fe-4fa2-97b5-bf7f076979d4\u0026player.uuid=297e095e-9ba0-4afa-b6d3-585fb05511ad"
},
"meta": {
"totalItems": 1,
"itemsPerPage": 30,
"currentPage": 1
},
"data": [
{
"id": "\/american-football\/v2\/performances\/e6829419-b7b1-3cea-9e4f-047e93fcedae",
"type": "Performance",
"attributes": {
"uuid": "e6829419-b7b1-3cea-9e4f-047e93fcedae",
"passingAttempts": null,
"passingCompletions": null,
"passingYards": null,
"passingTouchdowns": null,
"passingInterceptions": null,
"rushingAttempts": null,
"rushingTouchdowns": null,
"rushingYards": null,
"rushingLongest": null,
"receivingReceptions": 4.25,
"receivingYards": 55.224,
"receivingLongest": 26.678,
"receivingTouchdowns": 0.58,
"defenseCombined": null,
"defenseInterceptions": null,
"totalReturnsYards": null,
"defenseSacks": null,
"fieldGoalsMade": null,
"fieldGoalsAttempts": null,
"fieldGoalsLongest": null,
"fieldGoalsYards": null,
"puntsAttempts": null,
"puntsYards": null,
"defenseTackles": null,
"defenseAssists": null,
"receivingAvgYards": 12.994,
"receivingYardsAfterCatch": 20.984,
"puntsLongest": null,
"passingLongest": null,
"passingCmpPct": null,
"passingSacks": null,
"passingSackYards": null,
"rushingAvgYards": null,
"fumblesFumbles": null,
"puntsHangTime": null,
"puntsInside20": null,
"puntsReturnYards": null,
"puntsNetYards": null,
"puntsAvgYards": null,
"puntsAvgNetYards": null,
"puntsAvgHangTime": null,
"puntsTouchbacks": null,
"defensePassesDefended": null,
"defenseTloss": null,
"defenseReturnsYards": null,
"puntReturnsAvgYards": 0,
"puntReturnsYards": 0,
"puntReturnsLongest": 0,
"puntReturnsNumber": 0,
"kickReturnsAvgYards": 0,
"kickReturnsYards": 0,
"kickReturnsLongest": 0,
"kickReturnsNumber": 0,
"kickReturnsTouchdowns": 0,
"kickReturnsLongestTouchdown": 0,
"rushingYards100Plus": null,
"passingYards300Plus": null,
"passingTouchdowns3Plus": null,
"startingProbability": null,
"predictAsStarter": false
},
"relationships": {
"player": {
"data": {
"type": "Player",
"id": "\/american-football\/v2\/players\/297e095e-9ba0-4afa-b6d3-585fb05511ad"
}
},
"event": {
"data": {
"type": "Event",
"id": "\/american-football\/v2\/events\/d2554158-f1fe-4fa2-97b5-bf7f076979d4"
}
},
"team": {
"data": {
"type": "Team",
"id": "\/american-football\/v2\/teams\/499a829d-e18d-4b3a-81a8-7aad418fef95"
}
}
}
}
]
}
The resulting performance
Entity gives you various player related pre-game probabilities depending on the league and/or sport.