Baseball

Baseball rules can be found here: http://mlb.mlb.com/mlb/official_info/official_rules
This document describes the baseball 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.

{
"BatterPlayerId":389877,
"CustomerId":6105,
"FirstBasePlayerId":456210,
"FirstBaseOccupied":false,
"FixtureId":4462599,
"IsReliable":true,
"MessageTimestampUtc":"2017-03-08T13:29:14.52Z",
"Phase":InProgress,
"MatchDuration": null,
"WinningPitcher": null,
"LosingPitcher": null,
"SavingPitcher": null,
"BallInPlay":Unknown,
"PitchCount":{},
"PitcherPlayerId":5884211,
"SecondBasePlayerId":456211,
"SecondBaseOccupied":false,
"ThirdBasePlayerId": 456212,
"ThirdBaseOccupied":false,
"TotalErrors": {},
"TotalHits": {},
"TotalRuns": {},
"Innings": {}
} 

Element

Type

Description

BatterPlayerId

String

An immutable identifier for the batter

CustomerId

Integer

An immutable identifier for the customer

FirstBasePlayerId

String

An immutable identifier for the first base

FirstBaseOccupied

Boolean

True if the base has been occupied

FixtureId

String

An immutable identifier for the event

IsReliable

Boolean

True if all summarised information is reliable. False if at least one of the summarised collections is unreliable.

MessageTimestampUtc

Datetime

The time that the message is sent, UTC

Phase

MatchPhase

The phase of play during which the action happened, possible values are:
PreGame
InProgress
PostGame
Suspended
Cancelled
Postponed
Abandoned

BallInPlayEnum

Indicates whether the ball is in play or not. Possible values are:
Yes

No

Unknown (Default)

PitchCount

PitchCount

A collection of PitchCount objects that summarises the pitch count

PitcherPlayerId

String

An immutable identifier for the pitcher

SecondBasePlayerId

String

An immutable identifier for the second base

SecondBaseOccupied

Boolean

True if the base has been occupied

ThirdBasePlayerId

String

An immutable identifier for the third base

ThirdBaseOccupied

Boolean

True if the base has been occupied

TotalErrors

Score

A collection of TotalErrors objects that summarises the total errors

TotalHits

Score

A collection of TotalHits objects that summarises the total hits

TotalRuns

Score

A collection of TotalRuns objects that summarises the total runs

Innings

ArrayOfInningDetails

A collection of Innings objects that summarises the inning details

MatchDuration
Not currently used (null)
WinningPitcher
Not currently used (null)
LosingPitcher
Not currently used (null)
SavingPitcher
Not currently used (null)




PitchCount

A collection of objects describing Pitch.

{
"Balls":1,
"Strikes":2,
"TotalPitches":3
}

Element

Type

Description

Balls

Integer

Describes total balls by the current Pitcher

Strikes

Integer

Describes Strikes by the current Pitcher

TotalPitches

Integer

Describes total pitches by the current Pitcher


Score

A collection of objects describing Score.

{
"Home":0,
"Away":0
} 

Element

Type

Description

Home

Integer

Integer count of Home total errors

Away

Integer

Integer count of Away total errors



ArrayOfInningDetails

A collection of objects describing the Inning

{
"Errors":{},
"Hits":{},
"InningNumber":1,
"LeftOnBase":{},
"Outs":{},
"Runs":{},
"Status": Finished
} 

Element

Type

Description

Errors

Score

A collection of Errors objects that summarises the total errors

Hits

Score

A collection of Hits objects that summarises the total hits

InningNumber

Integer

Describes the inning played

LeftOnBase

Score

A collection of LeftOnBase objects that summarises the players on base

Outs

Score

A collection of Outs objects that summarises the total outs

Runs

Score

A collection of Runs objects that summarises the total runs

Status

InningStatus

Describes the Inning status, possible values are:
Top
Middle
Bottom
Finished



PlateAppearances

Element

Type

Description

Actions

Array

Sequence
TimestampUtc
BatterPlayerId
PitcherPlayerId
PitchCount
PitchType
Action
RunnerMovements
FieldingPlay
ErrorMade
ErrorPlayerIds

Outcomes

Array

TimestampUtc
Result
Trajectory
Velocity
Direction
DistanceInFeet
FinishingBase
BatterOut
BatterScored
FieldersChoice
HitCredited
IsConfirmed

Match Details Message

The Match Details message contains the details of the game so far, including points scored, errors committed and runs.

{
"BatterPlayerId":512331,
"CustomerId":6105,
"FirstBasePlayerId":456210,
"FirstBaseOccupied":false,
"FixtureId":4462599,
"IsReliable":true,
"MessageTimestampUtc":"2017-03-08T13:29:14.52Z",
"Phase":PreGame,"MatchDuration": null,
"WinningPitcher": null,
"LosingPitcher": null,
"SavingPitcher": null,
"BallInPlay":Unknown,
"PitchCount":{},
"PitcherPlayerId":5884211,
"SecondBasePlayerId":456211,
"SecondBaseOccupied":false,
"ThirdBasePlayerId": 456212,
"ThirdBaseOccupied":false,
"TotalErrors": {},
"TotalHits": {},
"TotalRuns": {},
"AwayBattingLineup": {},
"AwayPlayers": {},
"AwayStartingLineup": {},
"HomeBattingLineup": {},
"HomePlayers": {},
"HomeStartingLineup": {},
"Innings": {}
}

Element

Type

Description

BatterPlayerId

String

An immutable identifier for the batter

CustomerId

Integer

An immutable identifier for the customer

FirstBasePlayerId

String

An immutable identifier for the first base

FirstBaseOccupied

Boolean

True if the base has been occupied

FixtureId

String

An immutable identifier for the event

IsReliable

Boolean

True if all summarised information is reliable. False if at least one of the summarised collections is unreliable.

MessageTimestampUtc

Datetime

The time that the message is sent, UTC

Phase

MatchPhase

The phase of play during which the action happened

BallInPlay




Enum

Indicates whether the ball is in play or not. Possible values are:
Yes

No

Unknown (Default)

PitchCount

PitchCount

A collection of PitchCount objects that summarises the pitch count

PitcherPlayerId

String

An immutable identifier for the pitcher

SecondBasePlayerId

String

An immutable identifier for the second base

SecondBaseOccupied

Boolean

True if the base has been occupied

ThirdBasePlayerId

String

An immutable identifier for the third base

ThirdBaseOccupied

Boolean

True if the base has been occupied

TotalErrors

TotalErrors

A collection of TotalErrors objects that summarises the total errors

TotalHits

TotalHits

A collection of TotalHits objects that summarises the total hits

TotalRuns

TotalRuns

A collection of TotalRuns objects that summarises the total runs

AwayBattingLineup

BattingLineup

A collection of BattingLineup objects that summarises batting line up

AwayPlayers

ArrayOfPlayer

An Array Of Player objects that summarises players in team

AwayStartingLineup

ArrayOfLineupEntry

An Array Of Player objects that summarises staring line up for a team

HomeBattingLineup

BattingLineup

A collection of BattingLineup objects that summarises batting line up

HomePlayers

ArrayOfPlayer

An Array Of Player objects that summarises players in team

HomeStartingLineup

ArrayOfLineupEntry

An Array Of Player objects that summarises staring line up for a team

Innings

ArrayOfInningDetails

A collection of Innings objects that summarises the inning details

MatchDuration
Not currently used (null)
WinningPitcher
Not currently used (null)
LosingPitcher
Not currently used (null)
SavingPitcher
Not currently used (null)




BattingLineup

A collection of objects describing Batting line up

{
"CurrentBatterId":621637,
"LineupEntry":6105
} 

Element

Type

Description

CurrentBatterId

String

An immutable identifier for the current batter

LineupEntry

ArrayOfLineupEntry

 


ArrayOfLineupEntry

A collection of objects describing line up

{
"BattingSlot":1,
"PlayerId":551022,
"Position":ShortStop
} 

Element

Type

Description

BattingSlot

Integer

Player order for the batting slot

PlayerId

String

An immutable identifier for the pitcher

Position

PlayerPosition

Player position, possible values:
Unknown
Pitcher
Catcher
FirstBase
SecondBase
ThirdBase
ShortStop
LeftField
CenterField
RightField
PinchHitter
DesignatedHitter
PinchRunner



ArrayOfPlayer

A collection of objects describing players

{
"BattingHand":Left,
"PlayerId":551022,
"Name":Stephen Drew,
"SourceId":null,
"ThrowingHand":Right 
} 

Element

Type

Description

BattingHand

Hand

Describes players batting hand, possible values are:
Unknown
Right
Left

PlayerId

String

An immutable identifier for the pitcher

Name

String

Player name

SourceId

String

An immutable identifier for the pitcher

ThrowingHand

Hand

Describes players throwing hand, possible values are:
Unknown
Right
Left



ArrayOfInningDetails

A collection of objects describing the Inning

{
"Errors":{},
"Hits":{},
"InningNumber":1,
"LeftOnBase":{},
"Outs":{},
"Runs":{},
"Status": Finished
} 

Element

Type

Description

Errors

Score

A collection of Errors objects that summarises the total errors

Hits

Score

A collection of Hits objects that summarises the total hits

InningNumber

Integer

Describes the inning played

LeftOnBase

Score

A collection of LeftOnBase objects that summarises the players on base

Outs

Score

A collection of Outs objects that summarises the total outs

Runs

Score

A collection of Runs objects that summarises the total runs

Status

InningStatus

Describes the Inning status, possible values are:
Top
Middle
Bottom
Finished

TopArrayPlateAppearances
StartedAtUtc
FinishedAtUtc
Substitutions
NumberOfOuts
Runs
PitcherStatistics
BottomArrayPlateAppearances
StartedAtUtc
FinishedAtUtc
Substitutions
NumberOfOuts
Runs
PitcherStatistics


PlateAppearances

Element

Type

Description

Actions

Array

Sequence
TimestampUtc
BatterPlayerId
PitcherPlayerId
PitchCount
PitchType
Action
RunnerMovements
FieldingPlay
ErrorMade
ErrorPlayerIds

Outcomes

Array

TimestampUtc
Result
Trajectory
Velocity
Direction
DistanceInFeet
FinishingBase
BatterOut
BatterScored
FieldersChoice
HitCredited
IsConfirmed

Actions

Element

Type

Description

Sequence

Int

SequenceId of the Action

TimeStampUtc

Date

The time that the message is sent, UTC
BatterPlayerIdStringAn immutable identifier for the batter
PitcherPlayerId

String

An immutable identifier for the batter
PitchCountArrayA collection of PitchCount objects that summarises the pitch count
PitchType
Not currently used
ActionArrayHitFair
HitFairWithRunnerMovingOnPitch
FoulBall
FoulBallRunnerMovingOnPitch
BuntedAndMissed
BuntedFoul
BuntedFoulRunnerMovingWithPitch
IntentionalBall
BlockedByCatcher
PitchOut
TakenStrike
SwingingStrike
SwingAtPitchout
BallRunnerMovingOnWalkResult
ErrorPreventedRunnerBeingCaughtStealing
DoubleSteal
TripleSteal
PickOffAttemptAtSecondBaseThrownToSecondBaseman
PickOffAttemptAtSecondBaseThrownToShortStopBaseman
PickOffAttemptAtThirdBase
PickoffThrowByCatcher
PickoffThrowErrorRunnerAdvance
PickoffThrowToFirstByPitcher
PitcherHandsToMouthWithoutUmpirePermission
ManagerVisitToMound
CoachVisitToMound
CaughtStealing
BaseRunnerOutForObstruction
BaseRunnerOutTryingToAdvance
BaseRunnersAdvanceNoDefensivePlay
BaseRunnersAdvanceOnFielderObstruction
BaseRunnersAdvanceOnFieldingError
RunnerAdvancesOnThrowToDifferentBase
RunnerMovements
Not currently used
FieldingPlay
Not currently used
ErrorMadeBoolean

True if an error has been made

ErrorPlayerIdsIntA collection of PitchCount objects that summarises the pitch count


Outcomes

Element

Type

Description

TimeStampUtc

Date

The time that the message is sent, UTC
ResultResultHitByPitch
BatterSafe
FanInterference
CatcherInterference
Double
FoulPoleHomeRun
FoulOut
FoulTipOnSwingingStrike
GroundRuleDouble
HomeRun
InsideTheParkHomeRun
InfieldDouble
InfieldHomeRun
InfieldSingle
InfieldTriple
IntentionalWalk
DoublePlay
DoublePlayRunnerOutOnAppeal
DoublePlayRunnerOutOnInterference
Out
OutForObstruction
OutOfOrderOut
Sacrifice
SacrificeOnFailedFieldersChoice
SacrificeDoublePlay
Single
StrikeOut
StrikeOutBatterReachesOnPassedBall
StrikeOutBatterReachesOnWildPitch
StrikeOutBatterThrownOutAtFirst
Triple
TriplePlay
Walk
Trajectory


Not currently used
Velocity
Not currently used
Direction
Not currently used
DistanceInFeet
Not currently used 
FinishingBaseFinishingBaseFirstBase
S
econdBase

ThirdBase
HomePlate
BatterOutBooleanTrue if Batter is out
BatterScoredBoolean

True if BatterScored

FieldersChoiceBooleanTrue if Fielder's Choice play is made
HitCreditedBooleanTrue if hit credited
IsConfirmedBooleanTrue if outcome confirmed