32 KiB
{{classname}}
All URIs are relative to https://statsapi.mlb.com
Method | HTTP request | Description |
---|---|---|
BeastStats | Get /api/v1/stats/search | View stats from search |
GetOutsAboveAverage | Get /api/v1/stats/analytics/outsAboveAverage | Get outs above average for the current batter |
GetSprayChart | Get /api/v1/stats/analytics/sprayChart | Get the spray chart info for the current batter |
GetStolenBaseProbability | Get /api/v1/stats/analytics/stolenBaseProbability | Get the probability of a hit for the given hit data |
GroupedStats | Get /api/v1/stats/grouped | View grouped stats |
Leaders2 | Get /api/v1/stats/leaders | Get leaders for a statistic |
MetricStats | Get /api/v1/stats/metrics | View metric stats |
Stats2 | Get /api/v1/stats | View stats |
BeastStats
StatContainerRestObject BeastStats(ctx, group, optional) View stats from search
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
group | **[]StatGroup** | Category of statistic to return. Available types in /api/v1/statGroups | |
optional | *StatsApiBeastStatsOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a StatsApiBeastStatsOpts struct
Name | Type | Description | Notes |
---|
gamePks | **optional.Interface of []int32**| Comma delimited list of unique primary keys | playIds | **optional.Interface of []string**| Comma delimited list of unique play identifiers | seasons | **optional.Interface of []string**| Comma delimited list of Seasons of play | gameTypes | **optional.Interface of []GameTypeEnum**| Type of Game. Available types in /api/v1/gameTypes | date | optional.String| Date of Game. Format: YYYY-MM-DD | startDate | optional.String| Date of Game. Format: YYYY-MM-DD | endDate | optional.String| Date of Game. Format: YYYY-MM-DD | teamIds | **optional.Interface of []int32**| Unique Team Identifier. Format: 141, 147, etc | pitcherTeamIds | **optional.Interface of []int32**| Unique Team Identifier. Format: 141, 147, etc | batterTeamIds | **optional.Interface of []int32**| Unique Team Identifier. Format: 141, 147, etc | sportIds | **optional.Interface of []int32**| Comma delimited list of top level organizations of a sport | pitcherSportIds | **optional.Interface of []int32**| Comma delimited list of top level organizations of a sport | batterSportIds | **optional.Interface of []int32**| Comma delimited list of top level organizations of a sport | leagueIds | **optional.Interface of []int32**| Comma delimited list of Unique league identifiers | pitcherLeagueIds | **optional.Interface of []int32**| Comma delimited list of Unique league identifiers | batterLeagueIds | **optional.Interface of []int32**| Comma delimited list of Unique league identifiers | divisionIds | **optional.Interface of []int32**| Comma delimited list of Unique League Identifiers | pitcherDivisionIds | **optional.Interface of []int32**| Comma delimited list of Unique League Identifiers | batterDivisionIds | **optional.Interface of []int32**| Comma delimited list of Unique League Identifiers | pitchersOnTeamIds | **optional.Interface of []int32**| Unique Team Identifier. Format: 141, 147, etc | battersOnTeamIds | **optional.Interface of []int32**| Unique Team Identifier. Format: 141, 147, etc | playerIds | **optional.Interface of []int32**| A unique identifier for a player | playerPool | optional.Interface of PlayerPoolEnum| Return "ALL" or only "QUALIFIED" players based on plate appearances. | pitcherIds | **optional.Interface of []int32**| A unique identifier for a player | batterIds | **optional.Interface of []int32**| A unique identifier for a player | catcherIds | **optional.Interface of []int32**| A unique identifier for a player | firstBasemanIds | **optional.Interface of []int32**| A unique identifier for a player | secondBasemanIds | **optional.Interface of []int32**| A unique identifier for a player | thirdBasemanIds | **optional.Interface of []int32**| A unique identifier for a player | shortstopIds | **optional.Interface of []int32**| A unique identifier for a player | leftFielderIds | **optional.Interface of []int32**| A unique identifier for a player | centerFielderIds | **optional.Interface of []int32**| A unique identifier for a player | rightFielderIds | **optional.Interface of []int32**| A unique identifier for a player | runnerFirstIds | **optional.Interface of []int32**| A unique identifier for a player | runnerSecondIds | **optional.Interface of []int32**| A unique identifier for a player | runnerThirdIds | **optional.Interface of []int32**| A unique identifier for a player | venueIds | **optional.Interface of []int32**| Unique Venue Identifier | pitchHand | optional.String| Handedness of pitcher | batSide | optional.String| Bat side of hitter | pitchTypes | **optional.Interface of []PitchType**| Classification of pitch (fastball, curveball, etc...) | pitchCodes | **optional.Interface of []PitchCode**| Result of the pitch (ball, called strike, etc...) | eventTypes | **optional.Interface of []EventType**| Type of event | positions | **optional.Interface of []BaseballPosition**| All of the details of a player's position | primaryPositions | **optional.Interface of []BaseballPosition**| All of the details of a player's position | minPitchSpeed | optional.Float64| Minimum value to filter on | maxPitchSpeed | optional.Float64| Maximum value to filter on | minSpinRate | optional.Float64| Minimum value to filter on | maxSpinRate | optional.Float64| Maximum value to filter on | minExtension | optional.Float64| Minimum value to filter on | maxExtension | optional.Float64| Maximum value to filter on | minExitVelocityAgainst | optional.Float64| Minimum value to filter on | maxExitVelocityAgainst | optional.Float64| Maximum value to filter on | minLaunchAngleAgainst | optional.Float64| Minimum value to filter on | maxLaunchAngleAgainst | optional.Float64| Maximum value to filter on | minExitVelocity | optional.Float64| Minimum value to filter on | maxExitVelocity | optional.Float64| Maximum value to filter on | minLaunchAngle | optional.Float64| Minimum value to filter on | maxLaunchAngle | optional.Float64| Maximum value to filter on | minHomeRunDistance | optional.Float64| Minimum value to filter on | maxHomeRunDistance | optional.Float64| Maximum value to filter on | minHitDistance | optional.Float64| Minimum value to filter on | maxHitDistance | optional.Float64| Maximum value to filter on | minHangTime | optional.Float64| Minimum value to filter on | maxHangTime | optional.Float64| Maximum value to filter on | minHitProbability | optional.Float64| Minimum value to filter on | maxHitProbability | optional.Float64| Maximum value to filter on | minCatchProbability | optional.Float64| Minimum value to filter on | maxCatchProbability | optional.Float64| Maximum value to filter on | minAttackAngle | optional.Float64| Minimum value to filter on | maxAttackAngle | optional.Float64| Maximum value to filter on | minBatSpeed | optional.Float64| Minimum value to filter on | maxBatSpeed | optional.Float64| Maximum value to filter on | minHomeRunXBallparks | optional.Float64| Minimum value to filter on | maxHomeRunXBallparks | optional.Float64| Maximum value to filter on | isBarrel | optional.Bool| Whether or not a play resulted in a barreled ball | hitTrajectories | **optional.Interface of []HitTrajectory**| Trajectory of hit (line drive, fly ball, etc...) | limit | optional.Int32| Number of results to return | offset | optional.Int32| The pointer to start for a return set; used for pagination | groupBy | **optional.Interface of []GroupByEnum**| Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP | compareOver | **optional.Interface of []GroupByEnum**| Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP | sortStat | optional.Interface of BaseballStatsEnum| Baseball stat to sort splits by. | sortModifier | optional.Interface of AggregateSortTypeEnum| The prefix modifier for the sort stat. avg, min, max. I.E minExitVelocity, maxLaunchAngle, avgHitDistance | sortOrder | optional.Interface of SortOrderEnum| The order of sorting, ascending or descending | percentile | optional.Int32| Only return averages above this percentile. used for best effort plays | minOccurrences | optional.Int32| Minimum occurrences to filter upon | minPlateAppearances | optional.Int32| Minimum occurrences to filter upon | minInnings | optional.Int32| Minimum occurrences to filter upon | qualifierRate | optional.Float64| Minimum occurrences to filter upon | sitCodes | **optional.Interface of []string**| Situation code for a given stat split. | showTotals | optional.Bool| Columns to return totals | includeNullMetrics | optional.Bool| Show events with null metrics | statFields | **optional.Interface of []StatField**| Baseball stat fields to populate | atBatNumbers | **optional.Interface of []int32**| The at bat number of a given game. Format: 1, 2, 3, etc | pitchNumbers | **optional.Interface of []int32**| The pitch number of a given game. Format: 1, 2, 3, etc | fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute | debug | optional.Bool| | activeStatus | optional.Interface of PlayerActiveStatusEnum| Whether or not a player is active |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetOutsAboveAverage
StatsRestObject GetOutsAboveAverage(ctx, gamePk, optional) Get outs above average for the current batter
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
gamePk | int32 | ||
optional | *StatsApiGetOutsAboveAverageOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a StatsApiGetOutsAboveAverageOpts struct
Name | Type | Description | Notes |
---|
timecode | optional.String| | fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetSprayChart
StatsRestObject GetSprayChart(ctx, gamePk, optional) Get the spray chart info for the current batter
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
gamePk | int32 | ||
optional | *StatsApiGetSprayChartOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a StatsApiGetSprayChartOpts struct
Name | Type | Description | Notes |
---|
timecode | optional.String| | fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetStolenBaseProbability
[]int32 GetStolenBaseProbability(ctx, gamePk, optional) Get the probability of a hit for the given hit data
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
gamePk | int32 | ||
optional | *StatsApiGetStolenBaseProbabilityOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a StatsApiGetStolenBaseProbabilityOpts struct
Name | Type | Description | Notes |
---|
timecode | optional.String| |
Return type
[]int32
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GroupedStats
StatsRestObject GroupedStats(ctx, stats, group, optional) View grouped stats
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
stats | **[]StatType** | Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes | |
group | **[]StatGroup** | Category of statistic to return. Available types in /api/v1/statGroups | |
optional | *StatsApiGroupedStatsOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a StatsApiGroupedStatsOpts struct
Name | Type | Description | Notes |
---|
personId | optional.Int32| Unique Player Identifier. Format: 434538, 429665, etc | teamId | optional.Int32| Unique Team Identifier. Format: 141, 147, etc | teamIds | **optional.Interface of []int32**| Comma delimited list of Unique Team identifiers | gameType | optional.Interface of GameTypeEnum| Type of Game. Available types in /api/v1/gameTypes | season | optional.String| Season of play | seasons | **optional.Interface of []string**| Comma delimited list of Seasons of play | sportId | optional.Int32| Top level organization of a sport | sportIds | **optional.Interface of []int32**| Comma delimited list of top level organizations of a sport | leagueId | optional.Int32| Unique League Identifier | leagueIds | **optional.Interface of []int32**| Comma delimited list of Unique league identifiers | leagueListId | optional.Interface of LeagueListsEnum| Unique League List Identifier | metrics | **optional.Interface of []MetricType**| Name of metric(s) for metric log stats. Available metrics in /api/v1/metrics | gamePk | optional.Int32| Unique Primary Key Representing a Game | batterTeamId | **optional.Interface of []int32**| A unique identifier for the batter's team | pitcherTeamId | **optional.Interface of []int32**| A unique identifier for the pitcher's team | batterId | optional.Int32| Unique Player Identifier. Format: 434538, 429665, etc | pitcherId | optional.Int32| Unique Player Identifier. Format: 434538, 429665, etc | sitCodes | **optional.Interface of []string**| Situation code for a given stat split. | combineSits | optional.Bool| If true, gathers stats where all of the situational criteria are met. If false, returns stats where any of the situational criteria are met. Default: false | opposingTeamId | optional.Int32| A unique identifier for the opposing team. Must be used with Team ID | fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute | sortStat | optional.Interface of BaseballStatsEnum| Baseball stat to sort splits by. | order | optional.Interface of SortOrderEnum| The order of sorting, ascending or descending | playerPool | optional.Interface of PlayerPoolEnum| Return "ALL" or only "QUALIFIED" players based on plate appearances. | position | **optional.Interface of []BaseballPosition**| Position number. Format: 1, 2, 3, etc | startDate | optional.String| Start date for range of data (must be used with end date). Format: MM/DD/YYYY | endDate | optional.String| End date for range of data (must be used with start date). Format: MM/DD/YYYY | daysBack | optional.Int32| Returns results from the last 'X' days (Starting from yesterday). | gamesBack | optional.Int32| Returns results from the last 'X' games played. | excludeTradedPlayers | optional.Bool| Excludes players who have since been traded from the input team | offset | optional.Int32| The pointer to start for a return set; used for pagination | limit | optional.Int32| Number of results to return | statFields | **optional.Interface of []StatField**| Baseball stat fields to populate | sortField | optional.Interface of StatField| Baseball statField to sort on. If no statField is given, sortField defaults to BASIC. If 1 statField is given, that is the default sortField. |
Return type
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Leaders2
LeagueLeaderContainerRestObject Leaders2(ctx, optional) Get leaders for a statistic
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | *StatsApiLeaders2Opts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a StatsApiLeaders2Opts struct
Return type
LeagueLeaderContainerRestObject
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to README]
MetricStats
StatsRestObject MetricStats(ctx, stats, metrics, optional) View metric stats
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
stats | **[]StatType** | Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes | |
metrics | **[]MetricType** | Name of metric(s) for metric log stats. Available metrics in /api/v1/metrics | |
optional | *StatsApiMetricStatsOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a StatsApiMetricStatsOpts struct
Name | Type | Description | Notes |
---|
personId | optional.Int32| Unique Player Identifier. Format: 434538, 429665, etc | personIds | **optional.Interface of []int32**| Unique Player Identifier. Format: 434538, 429665, etc | batterId | optional.Int32| Unique Player Identifier. Format: 434538, 429665, etc | pitcherId | optional.Int32| Unique Player Identifier. Format: 434538, 429665, etc | teamId | optional.Int32| Unique Team Identifier. Format: 141, 147, etc | group | **optional.Interface of []StatGroup**| Category of statistic to return. Available types in /api/v1/statGroups | season | optional.String| Season of play | seasons | **optional.Interface of []string**| Comma delimited list of Seasons of play | sportId | optional.Int32| Top level organization of a sport | opposingTeamId | optional.Int32| A unique identifier for the opposing team. Must be used with Team ID | opposingPlayerId | optional.Int32| A unique identifier for the opposing team | position | **optional.Interface of []BaseballPosition**| All of the details of a player's position | eventType | **optional.Interface of []EventType**| Type of event | pitchType | **optional.Interface of []string**| Classification of pitch (fastball, curveball, etc...) | hitTrajectory | **optional.Interface of []HitTrajectory**| Trajectory of hit (line drive, fly ball, etc...) | batSide | optional.String| Bat side of hitter | pitchHand | optional.String| Handedness of pitcher | venueId | **optional.Interface of []int32**| All of the details of a venue | gamePk | optional.Int32| Unique Primary Key Representing a Game | minValue | optional.Float64| Minimum value to filter on | maxValue | optional.Float64| Maximum value to filter on | percentile | optional.Int32| Only return averages above this percentile. used for best effort plays | minOccurrences | optional.Int32| Minimum occurrences to filter upon | offset | optional.Int32| The pointer to start for a return set; used for pagination | limit | optional.Int32| Number of results to return | order | optional.Interface of SortOrderEnum| The order of sorting, ascending or descending | date | optional.String| Date of Game. Format: YYYY-MM-DD | startDate | optional.String| Start date for range of data (must be used with end date). Format: MM/DD/YYYY | endDate | optional.String| End date for range of data (must be used with start date). Format: MM/DD/YYYY | gameType | optional.Interface of GameTypeEnum| Type of Game. Available types in /api/v1/gameTypes | batterTeamId | **optional.Interface of []int32**| A unique identifier for the batter's team | pitcherTeamId | **optional.Interface of []int32**| A unique identifier for the pitcher's team | fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute | debug | optional.Bool| |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Stats2
StatsRestObject Stats2(ctx, stats, group, optional) View stats
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
stats | **[]StatType** | Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes | |
group | **[]StatGroup** | Category of statistic to return. Available types in /api/v1/statGroups | |
optional | *StatsApiStats2Opts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a StatsApiStats2Opts struct
Name | Type | Description | Notes |
---|
personId | optional.Int32| Unique Player Identifier. Format: 434538, 429665, etc | teamId | optional.Int32| Unique Team Identifier. Format: 141, 147, etc | teamIds | **optional.Interface of []int32**| Comma delimited list of Unique Team identifiers | gameType | optional.Interface of GameTypeEnum| Type of Game. Available types in /api/v1/gameTypes | season | optional.String| Season of play | seasons | **optional.Interface of []string**| Comma delimited list of Seasons of play | sportId | optional.Int32| Top level organization of a sport | sportIds | **optional.Interface of []int32**| Comma delimited list of top level organizations of a sport | leagueId | optional.Int32| Unique League Identifier | leagueIds | **optional.Interface of []int32**| Comma delimited list of Unique league identifiers | leagueListId | optional.Interface of LeagueListsEnum| Unique League List Identifier | metrics | **optional.Interface of []MetricType**| Name of metric(s) for metric log stats. Available metrics in /api/v1/metrics | gamePk | optional.Int32| Unique Primary Key Representing a Game | batterTeamId | **optional.Interface of []int32**| A unique identifier for the batter's team | pitcherTeamId | **optional.Interface of []int32**| A unique identifier for the pitcher's team | batterId | optional.Int32| Unique Player Identifier. Format: 434538, 429665, etc | pitcherId | optional.Int32| Unique Player Identifier. Format: 434538, 429665, etc | sitCodes | **optional.Interface of []string**| Situation code for a given stat split. | combineSits | optional.Bool| If true, gathers stats where all of the situational criteria are met. If false, returns stats where any of the situational criteria are met. Default: false | opposingTeamId | optional.Int32| A unique identifier for the opposing team. Must be used with Team ID | fields | **optional.Interface of []string**| | sortStat | optional.Interface of BaseballStatsEnum| Baseball stat to sort splits by. | order | optional.Interface of SortOrderEnum| The order of sorting, ascending or descending | playerPool | optional.Interface of PlayerPoolEnum| Return "ALL" or only "QUALIFIED" players based on plate appearances. | position | **optional.Interface of []BaseballPosition**| Position number. Format: 1, 2, 3, etc | startDate | optional.String| Start date for range of data (must be used with end date). Format: MM/DD/YYYY | endDate | optional.String| End date for range of data (must be used with start date). Format: MM/DD/YYYY | daysBack | optional.Int32| Returns results from the last 'X' days (Starting from yesterday). | gamesBack | optional.Int32| Returns results from the last 'X' games played. | excludeTradedPlayers | optional.Bool| Excludes players who have since been traded from the input team | offset | optional.Int32| The pointer to start for a return set; used for pagination | limit | optional.Int32| Number of results to return |
Return type
Authorization
No authorization required
HTTP request headers
- Content-Type: Not defined
- Accept: /
[Back to top] [Back to API list] [Back to Model list] [Back to README]