20 KiB
{{classname}}
All URIs are relative to https://statsapi.mlb.com
Method | HTTP request | Description |
---|---|---|
Award | Get /api/v1/people/{personId}/awards | View a player's awards |
CurrentGameStats | Get /api/v1/people/changes | View a player's change log |
FreeAgents | Get /api/v1/people/freeAgents | Get free agents |
Person | Get /api/v1/people/{personId} | View a player |
Person1 | Get /api/v1/people | View a player |
PlayerGameStats | Get /api/v1/people/{personId}/stats/game/{gamePk} | View a player's game stats |
Search | Get /api/v1/people/search | Search for a player by name |
Stats3 | Get /api/v1/people/{personId}/stats | View a players stats |
StatsMetrics | Get /api/v1/people/{personId}/stats/metrics | View a player's stat metrics |
Award
AwardsRestObject Award(ctx, personId, optional) View a player's awards
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
personId | int32 | Unique Player Identifier. Format: 434538, 429665, etc | |
optional | *PersonApiAwardOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a PersonApiAwardOpts struct
Name | Type | Description | Notes |
---|
fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
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]
CurrentGameStats
PeopleRestObject CurrentGameStats(ctx, updatedSince, optional) View a player's change log
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
updatedSince | time.Time | Format: YYYY-MM-DDTHH:MM:SSZ | |
optional | *PersonApiCurrentGameStatsOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a PersonApiCurrentGameStatsOpts struct
Name | Type | Description | Notes |
---|
limit | optional.Int32| Number of results to return | offset | optional.Int32| The pointer to start for a return set; used for pagination | accent | optional.Bool| Boolean value to specify wanting a person's name with accents or without | fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
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]
FreeAgents
FreeAgentListRestObject FreeAgents(ctx, season, optional) Get free agents
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
season | string | Season of play | |
optional | *PersonApiFreeAgentsOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a PersonApiFreeAgentsOpts struct
Name | Type | Description | Notes |
---|
order | optional.Interface of SortOrderEnum| The order of sorting, ascending or descending | accent | optional.Bool| Boolean value to specify wanting a person's name with accents or without | fields | **optional.Interface of []string**| |
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]
Person
PeopleRestObject Person(ctx, personId, optional) View a player
This endpoint allows you to pull the information of players
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
personId | int32 | Unique Player Identifier. Format: 434538, 429665, etc | |
optional | *PersonApiPersonOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a PersonApiPersonOpts struct
Name | Type | Description | Notes |
---|
personIds | **optional.Interface of []int32**| Comma delimited list of person ID. Format: 1234, 2345 | accent | optional.Bool| Boolean value to specify wanting a person's name with accents or without | season | optional.String| Season of play | group | **optional.Interface of []StatGroup**| Category of statistic to return. Available types in /api/v1/statGroups | fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
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]
Person1
PeopleRestObject Person1(ctx, personId, optional) View a player
This endpoint allows you to pull the information of players
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
personId | int32 | Unique Player Identifier. Format: 434538, 429665, etc | |
optional | *PersonApiPerson1Opts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a PersonApiPerson1Opts struct
Name | Type | Description | Notes |
---|
personIds | **optional.Interface of []int32**| Comma delimited list of person ID. Format: 1234, 2345 | accent | optional.Bool| Boolean value to specify wanting a person's name with accents or without | season | optional.String| Season of play | group | **optional.Interface of []StatGroup**| Category of statistic to return. Available types in /api/v1/statGroups | fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
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]
PlayerGameStats
StatsRestObject PlayerGameStats(ctx, personId, gamePk, optional) View a player's game stats
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
personId | int32 | Unique Player Identifier. Format: 434538, 429665, etc | |
gamePk | int32 | Unique Primary Key Representing a Game | |
optional | *PersonApiPlayerGameStatsOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a PersonApiPlayerGameStatsOpts struct
Name | Type | Description | Notes |
---|
group | **optional.Interface of []StatGroup**| Category of statistic to return. Available types in /api/v1/statGroups | fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
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]
Search
PeopleRestObject Search(ctx, optional) Search for a player by name
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
optional | *PersonApiSearchOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a PersonApiSearchOpts struct
Name | Type | Description | Notes |
---|---|---|---|
names | **optional.Interface of []string** | Name a player uses | |
personIds | **optional.Interface of []int32** | Comma delimited list of person ID. Format: 1234, 2345 | |
sportIds | **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 | |
teamIds | **optional.Interface of []int32** | Comma delimited list of Unique Team identifiers | |
leagueListId | optional.Interface of LeagueListsEnum | Unique League List Identifier | |
active | optional.Bool | Whether or not a player is active | |
verified | optional.Bool | Complete and confirmed all biographical data | |
rookie | optional.Bool | Whether or not a player is a rookie | |
seasons | **optional.Interface of []string** | Comma delimited list of Seasons of play | |
fields | **optional.Interface of []string** | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute | |
accent | optional.Bool | Boolean value to specify wanting a person's name with accents or without | |
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]
Stats3
StatsRestObject Stats3(ctx, personId, stats, optional) View a players stats
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
personId | int32 | Unique Player Identifier. Format: 434538, 429665, etc | |
stats | **[]StatType** | Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes | |
optional | *PersonApiStats3Opts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a PersonApiStats3Opts struct
Name | Type | Description | Notes |
---|
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 | metrics | **optional.Interface of []MetricType**| Name of metric(s) for metric log stats. Available metrics in /api/v1/metrics | leagueId | optional.Int32| Unique League Identifier | leagueListId | optional.Interface of LeagueListsEnum| Unique League List Identifier | 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 | 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. | limit | optional.Int32| Number of results to return | 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 | gameType | **optional.Interface of []GameTypeEnum**| Type of Game. Available types in /api/v1/gameTypes | groupBy | **optional.Interface of []GroupByEnum**| Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP | accent | optional.Bool| Boolean value to specify wanting a person's name with accents or without | fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
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]
StatsMetrics
StatsRestObject StatsMetrics(ctx, personId, stats, optional) View a player's stat metrics
Required Parameters
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
personId | int32 | Unique Player Identifier. Format: 434538, 429665, etc | |
stats | **[]StatType** | Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes | |
optional | *PersonApiStatsMetricsOpts | optional parameters | nil if no parameters |
Optional Parameters
Optional parameters are passed through a pointer to a PersonApiStatsMetricsOpts struct
Name | Type | Description | Notes |
---|
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 | metrics | **optional.Interface of []MetricType**| Name of metric(s) for metric log stats. Available metrics in /api/v1/metrics | leagueId | optional.Int32| Unique League Identifier | leagueListId | optional.Interface of LeagueListsEnum| Unique League List Identifier | 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 | 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. | limit | optional.Int32| Number of results to return | 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 | gameType | **optional.Interface of []GameTypeEnum**| Type of Game. Available types in /api/v1/gameTypes | groupBy | **optional.Interface of []GroupByEnum**| Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP | accent | optional.Bool| Boolean value to specify wanting a person's name with accents or without | 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]