Basketball
- Martin Mand
- Aleksander Puumets
- Tonis Danilson
The InPlay service supports basketball matches played under the following rulesets:
- FIBA: http://www.fiba.basketball/basketball-rules
- NBA: http://www.nba.com/news/officiating/
- NCAA: http://www.ncaa.org/playing-rules/mens-basketball-rules-game
- PBA: uses NBA ruleset
- CBA: uses NBA ruleset
This document describes the V2 basketball match state contract.
Match Summary Message
The Match Summary message complements the Match Details message by summarising the important match information for rapid, easy access.
{ "FixtureId":2522243, "CustomerId":6105, "IsReliable":true, "Scores":{}, "FoulCount":{}, "NumberOfFreeThrowsRemaining":0, "Possession":2, "MatchTipOffWinner":"Home", "PossessionArrowDirection":null, "CurrentPhase": "SecondQuarter", "OvertimeCount":0, "IsClockRunning":true, "TimeRemainingInPhaseAtTimestamp":{}, "MessageTimestampUtc":"2014-02-28T12:01:06.398Z" }
Element | Type | Description |
---|---|---|
FixtureId | Integer | An immutable identifier for the event |
CustomerId | Integer | An immutable identifier for the customer |
IsReliable | Boolean | True if all summarised information is reliable. False if at least one of the summarised collections is unreliable. |
Scores | ScoreData | A collection of Score objects that summarises the scores at various points in the game |
FoulCount | FoulCount | An object that summarises the number of fouls committed by each team |
NumberOfFreeThrowsRemaining | Integer | The number of free throws remaining |
Possession | PossessionTeamSide | The team in possession of the ball |
MatchTipOffWinner | String | The team winning the tip-off for match. Possible values are: Unknown Home Away |
PossessionArrowDirection |
| Not currently used |
CurrentPhase | PhaseType | The phase of play during which the action happened |
OvertimeCount | Short | A count indicating the current overtime period |
IsClockRunning | Boolean | True if the clock is currently running; False otherwise |
TimeRemainingInPhaseAtTimestamp | TimestampedTime | The time left to play in the current phase, in milliseconds |
MessageTimestampUtc | DateTime | The time that the message is sent, UTC |
Scores
A collection of Score objects that summarises the scores at various points in the game.
{ "FirstTeamToScore":{}, "LastTeamToScore":{}, "FirstQuarterScore":{}, "SecondQuarterScore":{}, "ThirdQuarterScore":{}, "FourthQuarterScore":{}, "FirstHalfScore":{}, "SecondHalfScore":{}, "OvertimeScore":{}, "RegulationTimeFinalScore":{}, "CurrentScore":{} }
Element | Type | Description |
---|---|---|
FirstTeamToScore | TeamSide | Home if the home team scored first, Away if the away team scored first |
LastTeamToScore | TeamSide | Home if the home team scored last, Away if the away team scored last. Null until the game is over. Includes overtime. |
FirstQuarterScore | Score | The score in points of the first quarter; null until the end of the first quarter. |
SecondQuarterScore | Score | The score in points of the second quarter; null until the end of the second quarter. |
ThirdQuarterScore | Score | The score in points of the third quarter; null until the end of the third quarter. |
FourthQuarterScore | Score | The score in points of the fourth quarter; null until the end of the fourth quarter. |
FirstHalfScore | Score | The score in points of the first half; null until the end of the first half. |
SecondHalfScore | Score | The score in points of the second half; null until the end of the second half. |
OvertimeScore | Score | The score in points for the overtime period; null until the end of the overtime period. |
RegulationTimeFinalScore | Score | The score in points at the end of regulation time; null until the end of the regulation time. |
CurrentScore | Score | The current score in points |
TimestampedTimeRemainingInPhase
An object that describes the time remaining in the current phase.
{ "TimeRemainingInPhaseMilliseconds":451000, "TimeStampUtc":"2014-02-28T12:00:50.778Z" }
Element | Type | Description |
---|---|---|
TimeRemainingInPhaseMilliseconds | Integer | The time remaining in the phase in milliseconds from the last ClockAction. |
TimeStampUtc | DateTime | The time of the last ClockAction |
Match Details Message
The Match Details message contains the details of the game so far, including points scored, fouls committed and free throws taken.
{ "FixtureId":2681906, "CustomerId":6105, "GameActions":{}, "MessageTimestampUtc":"2014-02-26T10:12:11.956Z" }
Element | Type | Description |
---|---|---|
FixtureId | Integer | An immutable identifier for the event |
CustomerId | Integer | An immutable identifier for the bookmaker |
GameActions | GameActions | A collection of GameAction objects detailing the actions that have occurred so far in the game |
MessageTimestampUtc | DateTime | The time that the message is sent, UTC |
GameActions
A collection of Action objects that describe every action that has taken place within the game.
{ "ClockActions":{}, "Points":{}, "PossessionChanges":{}, "Fouls":{}, "FreeThrowOutcomes":{}, "PossessionArrowChanges":{}, "PhaseChanges":{}, "Timeouts":{} }
Element | Type | Description |
---|---|---|
ClockActions | ClockActivity | A collection of clock actions that describes the changes to the clock during the game |
Points | Point | A collection of point actions that describes all the points awarded during the game |
PossessionChanges | PossessionChange | A collection of possession change actions that describes all the possession changes made during the game |
Fouls | Foul | A collection of foul actions that describes all the fouls committed during the game |
FreeThrowOutcomes | FreeThrowOutcome | A collection of free throw outcome actions that describes all the outcomes of all the free throws awarded during the game |
PossessionArrowChanges | PossessionArrowChange | A collection of possession arrow change actions that describes all the possession arrow changes made during the game |
PhaseChanges | PhaseChange | A collection of phase change actions |
Timeouts | Timeout | A collection of timeout actions |
Each collection of Actions, ClockActions, Points, PossessionChanges etc., have the following attributes:
Element | Type | Description |
---|---|---|
IsCollected | Boolean | True when the data type is being collected and is available to be used. False indicates that the data type is not being collected. |
IsReliable | Boolean | False when the confidence in the accuracy of the associated information is not complete |
ClockActivity
A collection of Action objects that describe all the clock changes that have occurred during the game.
{ "CurrentPhase": "SecondQuarter", "OvertimeCount":0, "TimeRemainingInPhaseMilliseconds":600000, "TimeActionOccurredUtc":"2014-02-26T10:12:11.001Z", "ActivityType":0, "IsClockRunning":true }
Element | Type | Description |
---|---|---|
CurrentPhase | PhaseType | The phase of play during which the action happened |
OvertimeCount | Short | A count indicating the current overtime period |
TimeRemainingInPhaseMilliseconds | Integer | The time left to play in the current phase, in milliseconds |
TimeActionOccurredUtc | DateTime | The time that the action occurred, UTC |
ActivityType | ClockActivityType | The type of clock activity associated with the action |
IsClockRunning | Boolean | True if the clock is currently running; False otherwise |
PhaseType
Describes the phase of play during which an action happened. Can take the following values:
Name |
PreGame |
FirstQuarter |
BeforeSecondQuarter |
SecondQuarter |
FirstHalf |
HalfTime |
ThirdQuarter |
BeforeFourthQuarter |
FourthQuarter |
SecondHalf |
BeforeOvertime |
Overtime |
PostGame |
GameAbandoned |
ClockActivityType
The type of clock activity associated with the action. Can take the following values:
Value | Name | Description |
0 | Start | The clock has started |
1 | Stop | The clock has stopped |
2 | Adjustment | A small change to the current clock time, for example when the clock is nudged in the trading UI |
3 | SetClock | A large change to the current clock time |
Points
A collection of actions that describe all the points awarded during the game.
{ "CurrentPhase": "SecondQuarter", "OvertimeCount":0, "TimeRemainingInPhaseMilliseconds":576592, "TimeActionOccurredUtc":"2014-02-26T14:54:34.342Z", "PointType":1, "TeamScoring":1, "ScoreAfterPoint":{} "IsConfirmed":true }
Element | Type | Description |
---|---|---|
CurrentPhase | PhaseType | The phase of play during which the action happened |
OvertimeCount | Short | A count indicating the current overtime period |
TimeRemainingInPhaseMilliseconds | Integer | The time left to play in the current phase, in milliseconds |
TimeActionOccurredUtc | DateTime | The time that the action occurred, UTC |
PointType | PointType | Describes the type of point awarded |
TeamScoring | TeamSide | Details the team to which the action applies |
ScoreAfterPoint | Score | The game score after the point has been added |
IsConfirmed | Boolean | True if the points have been confirmed by the data feed supplier or if the points were added through the trading UI |
PointType
Describes the type of point awarded. Can take the following values:
Value | Name |
0 | FreeThrow |
1 | TwoPoint |
2 | ThreePoint |
3 | SetScore |
TeamSide
Some actions or scores are attributed to an individual team. TeamSide is an Enum that details the team to which its parent element applies. It can take the following values:
Value | Name | Description |
0 | Home | The home team |
1 | Away | The away team |
Score
An object that holds the current score in points.
{ "Home":0, "Away":2 }
Element | Type | Description |
---|---|---|
Home | Short | The home team's score in points |
Away | Short | The away team's score in points |
PossesssionChanges
A collection of Actions that describe changes of possession during the game.
{ "CurrentPhase": "SecondQuarter", "OvertimeCount":0, "TimeRemainingInPhaseMilliseconds":600000, "TimeActionOccurredUtc":"2014-02-26T14:54:09.78Z", "TeamInPossession":0 }
Element | Type | Description |
---|---|---|
CurrentPhase | PhaseType | The phase of play during which the action happened |
OvertimeCount | Short | A count indicating the current overtime period |
TimeRemainingInPhaseMilliseconds | Integer | The time left to play in the current phase, in milliseconds |
TimeActionOccurredUtc | DateTime | The time that the action occurred, UTC |
TeamInPossession | PossessionTeamSide | Describes the team in possession of the ball |
PossessionTeamSide
Describes the team in possession of the ball. Can take the following values:
Value | Name | Description |
0 | Neutral | Neither team has possession of the ball |
1 | Home | The home team has possession of the ball |
2 | Away | The away team has possession of the ball |
PossessionArrowChanges
A collection of Actions that describes the changes of the possession arrow during a game.
{ "PossessionArrowDirection": "Home", "CurrentPhase": "FirstQuarter", "OvertimeCount": 0, "TimeRemainingInPhaseMilliseconds": 600000, "TimeActionOccurredUtc": "2024-09-17T10:03:47Z" }
Element | Type | Description |
---|---|---|
PossessionArrowDirection | String | Indicates the team toward the possession arrow points |
CurrentPhase | PhaseType | The phase of play during which the direction changed |
OvertimeCount | Short | A count indicating the current overtime period |
TimeRemainingInPhaseMilliseconds | Integer | The time left to play in the current phase, in milliseconds |
TimeActionOccurredUtc | DateTime | The time the action occurred, UTc |
Fouls
A collection of actions that describe the fouls committed during the game.
{ "CurrentPhase":1, "OvertimeCount":0, "TimeRemainingInPhaseMilliseconds":576592, "TimeActionOccurredUtc":"2014-02-26T14:54:34.342Z", "ActionNumber":1, "FoulingTeam":1, "Type":2, "FoulCount":{}, "IncrementsFoulCount":true, "NumberOfFreeThrowsAwarded":2, "AreFreeThrowsCompleted":true }
Element | Type | Description |
---|---|---|
CurrentPhase | PhaseType | The phase of play during which the action happened |
OvertimeCount | Short | A count indicating the current overtime period |
TimeRemainingInPhaseMilliseconds | Integer | The time left to play in the current phase, in milliseconds |
TimeActionOccurredUtc | DateTime | The time that the action occurred, UTC |
ActionNumber | Integer | The foul action number linked from FreeThrowOutcome |
FoulingTeam | TeamSide | The team that committed the foul |
Type | FoulType | An enum describing the type of foul committed. Values: |
FoulCount | FoulCount | The foul count after the current foul has been added |
IncrementsFoulCount | Boolean | True if this foul increments the number of fouls counted in the game |
NumberOfFreeThrowsAwarded | Integer | The number of free throws awarded as a result of the foul |
AreFreeThrowsCompleted | Boolean | True once all free throws have been taken; False otherwise. |
FoulCount
An object that holds the current foul count.
{ "Home":0, "Away":2 }
Element | Type | Description |
---|---|---|
Home | Short | The number of fouls committed by the home team |
Away | Short | The number of fouls committed by the away team |
"And 1" Situation
An "And 1" situation occurs when a player scores a two or three point field goal and is fouled in the act of shooting. A single free-throw will be awareded in this situation. You can identify "And 1" situations using the following logic:
var lastFoul = matchState.GameActions.Fouls.LastOrDefault(); var isAnd1 = lastFoul != null && lastFoul.Type != FoulTypeDto.Technical && lastFoul.NumberOfFreeThrowsAwarded == 1 && lastFoul.AreFreeThrowsCompleted == false; if (isAnd1) { // Do And1 stuff }
In other words, take the last foul in the Fouls collection in GameActions and an "And 1" situation exists if all the following are true.
- The foul type is not Technical
- The last foul NumberOfFreeThrowsAwarded is 1
- The last foul AreFreeThrowsCompleted is false
FreeThrowOutcomes
A collection of Actions that describes the free throws taken during a game.
{ "CurrentPhase":"SecondQuarter", "OvertimeCount":0, "TimeRemainingInPhaseMilliseconds":556373, "TimeActionOccurredUtc":"2014-02-26T14:55:05.327Z", "Scored":true, "AssociatedFoulActionNumber":8 }
Element | Type | Description |
---|---|---|
CurrentPhase | PhaseType | The phase of play during which the action happened |
OvertimeCount | Short | A count indicating the current overtime period |
TimeRemainingInPhaseMilliseconds | Integer | The time left to play in the current phase, in milliseconds |
TimeActionOccurredUtc | DateTime | The time that the action occurred, UTC |
Scored | Boolean | True indicates that the free throw resulted in a score |
AssociatedFoulActionNumber | Integer | The foul action number associated with this free throw |
PhaseChanges
A collection of Actions that describe changes of phase during the game.
{ "CurrentPhase": "SecondQuarter", "OvertimeCount":0, "TimeRemainingInPhaseMilliseconds":600000, "TimeActionOccurredUtc":"2014-02-26T14:54:09.78Z", "IsConfirmed":true }
Element | Type | Description |
---|---|---|
CurrentPhase | PhaseType | The phase of play during which the action happened |
OvertimeCount | Short | A count indicating the current overtime period |
TimeRemainingInPhaseMilliseconds | Integer | The time left to play in the current phase, in milliseconds |
TimeActionOccurredUtc | DateTime | The time that the action occurred, UTC |
IsConfirmed | Boolean | True if the phase change has been confirmed, False otherwise |
Timeouts
A collection of Actions that describe timeouts during the game.
{ "Actions": [], "IsCollected": true, "IsReliable": false }
Element | Type | Description |
---|---|---|
Actions | ArrayOfTimeout | Array of Timeout objects |
IsCollected | Boolean | True if data is collected, false otherwise |
IsReliable | Boolean | True if data is reliable, false otherwise |
Timeout
An object describing a single timeout action.
{ "Team": "Home", "OvertimeCount": 0, "CurrentPhase": "ThirdQuarter", "TimeRemainingInPhaseMilliseconds": "499510", "TimeActionOccurredUtc": "2016-08-06T16:47:29Z", "IsConfirmed": true }
Element | Type | Description |
---|---|---|
Team | String | Describes the team |
OvertimeCount | Integer | Describes the Overtime count |
CurrentPhase | String | Describes the current phase |
TimeRemainingInPhaseMilliseconds | Duration | Describes the time remaining in phase |
TimeActionOccuredUtc | DateTime | Describes the action timestamp |
IsConfirmed | Boolean | True if action is confirmed, false otherwise |
MatchTipOffWinner
MatchTipOffWinnerChanges
A collection of actions that describe tip-off winner for a match.
{ "Actions": [], "IsCollected": true, "IsReliable": false }
Element | Type | Description |
---|---|---|
Actions | ArrayofMatchTipOffWinners | Array of Match tip-off winner objects |
IsCollected | Boolean | True if data is collected, false otherwise |
IsReliable | Boolean | True if data is collected, false otherwise |
MatchTipOffWinner
An object describing the winner of tip-off in a match.
Please note that due to an error in development duplicate array called "MatchTipOfferWinner" exists in the Details message. The "MatchTipOfferWinner" collection array can be safely ignored and it will be removed from the message in the coming future.
{ "MatchTipOffWinner": "Home", "CurrentPhase": "FirstQuarter", "TimeRemainingInPhaseMilliseconds": "499510", "TimeActionOccurredUtc": "2016-08-06T16:47:29Z", "IsConfirmed": true }
Element | Type | Description |
---|---|---|
MatchTipOffWinner | String | The team winning the tip-off for match. Possible values are: Unknown Home Away |
CurrentPhase | String | Describes the current phase |
TimeRemainingInPhaseMilliseconds | Duration | Describes the time remaining in phase |
TimeActionOccuredUtc | DateTime | Describes the action timestamp |
IsConfirmed | Boolean | True if action is confirmed, false otherwise |