mlbstats/api/docs/AnalyticsApi.md

20 KiB

{{classname}}

All URIs are relative to https://statsapi.mlb.com

Method HTTP request Description
ContextMetrics Get /api/v1/game/{gamePk}/{guid}/contextMetrics Get context metrics for a specific gamePk.
ContextMetricsWithAverages Get /api/v1/game/{gamePk}/{guid}/contextMetricsAverages Get a json file containing raw coordinate data and refined calculated metrics.
ContextMetricsWithAveragesPost Post /api/v1/game/{gamePk}/{guid}/contextMetricsAverages Get a json file containing raw coordinate data and refined calculated metrics.
GameGuids Get /api/v1/game/{gamePk}/guids Get the GUIDs (plays) for a specific game.
GameGuidsFromPostgresRange Get /api/v1/analytics/guids Get the GUIDs (plays) for a specific game.
GameGuidsFromPostgresRangeByGame Get /api/v1/analytics/game Get all games by updated date.
GameLastPitch Get /api/v1/game/lastPitch Get the last pitch for a list of games
HomeRunBallparks Get /api/v1/game/{gamePk}/{guid}/homeRunBallparks Get if the play is a home run is each park for a specific play.
ParsedJsonFormattedAnalytics Get /api/v1/game/{gamePk}/{guid}/analytics Get Statcast data for a specific play.

ContextMetrics

[]CalculatedMetricRestObject ContextMetrics(ctx, gamePk, guid, optional) Get context metrics for a specific gamePk.

Returns a json file containing raw coordinate data and refined calculated metrics.

This responses can be very large, so it is strongly recommended that you pass "Accept-Encoding: gzip" as a header to have the responses compressed.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
gamePk int32 Unique Primary Key Representing a Game
guid string Unique identifier for a play within a game
optional *AnalyticsApiContextMetricsOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a AnalyticsApiContextMetricsOpts 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

**[]CalculatedMetricRestObject**

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ContextMetricsWithAverages

[]CalculatedMetricRestObject ContextMetricsWithAverages(ctx, gamePk, guid, optional) Get a json file containing raw coordinate data and refined calculated metrics.

Returns a json file containing raw coordinate data and refined calculated metrics.

This responses can be very large, so it is strongly recommended that you pass "Accept-Encoding: gzip" as a header to have the responses compressed.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
gamePk int32 Unique Primary Key Representing a Game
guid string Unique identifier for a play within a game
optional *AnalyticsApiContextMetricsWithAveragesOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a AnalyticsApiContextMetricsWithAveragesOpts 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

**[]CalculatedMetricRestObject**

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ContextMetricsWithAveragesPost

[]CalculatedMetricRestObject ContextMetricsWithAveragesPost(ctx, gamePk, guid, optional) Get a json file containing raw coordinate data and refined calculated metrics.

Returns a json file containing raw coordinate data and refined calculated metrics.

This responses can be very large, so it is strongly recommended that you pass "Accept-Encoding: gzip" as a header to have the responses compressed.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
gamePk int32 Unique Primary Key Representing a Game
guid string Unique identifier for a play within a game
optional *AnalyticsApiContextMetricsWithAveragesPostOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a AnalyticsApiContextMetricsWithAveragesPostOpts 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

**[]CalculatedMetricRestObject**

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GameGuids

[]AnalyticsPlayMetadataRestObject GameGuids(ctx, gamePk, optional) Get the GUIDs (plays) for a specific game.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
gamePk int32 Unique Primary Key Representing a Game
optional *AnalyticsApiGameGuidsOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a AnalyticsApiGameGuidsOpts struct

Name Type Description Notes

fields | **optional.Interface of []string**| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute | gameModeId | optional.Int32| Statcast game mode. Format: 0 = Batting Practive, 1 = Warmup 2 = Live | isPitch | optional.Bool| If there was a pitch | isHit | optional.Bool| If there was a hit ball tracked | isPickoff | optional.Bool| If there was a pickoff | hasUpdates | optional.Bool| True if updated by an auditor | since | optional.Time| Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ | updatedSince | optional.Time| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ | lastPlayTime | optional.Time| Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ | lastUpdatedTime | optional.Time| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ | lastMetricsUpdatedTime | optional.Time| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ | lastAuditUpdatedTime | optional.Time| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ | lastVideoUpdatedTime | optional.Time| The last time SportyBot video was updated |

Return type

**[]AnalyticsPlayMetadataRestObject**

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GameGuidsFromPostgresRange

AnalyticsPlayMetadataWrapperRestObject GameGuidsFromPostgresRange(ctx, optional) Get the GUIDs (plays) for a specific game.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
optional *AnalyticsApiGameGuidsFromPostgresRangeOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a AnalyticsApiGameGuidsFromPostgresRangeOpts struct

Name Type Description Notes
fields **optional.Interface of []string** Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
gameModeId optional.Int32 Statcast game mode. Format: 0 = Batting Practive, 1 = Warmup 2 = Live
isPitch optional.Bool If there was a pitch
isHit optional.Bool If there was a hit ball tracked
isPickoff optional.Bool If there was a pickoff
isNonStatcast optional.Bool If non statcast games need to be included
gamedayType optional.String Indicates the level of Gameday (tracking, play-by-play, linescore, etc...)
hasUpdates optional.Bool True if updated by an auditor
lastPlayTime optional.Time Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ
lastUpdatedTime optional.Time Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
lastMetricsUpdatedTime optional.Time Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
lastAuditUpdatedTime optional.Time Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
lastVideoUpdatedTime optional.Time The last time SportyBot video was updated
gameDate optional.String Date of Game. Format: YYYY-MM-DD
sportId optional.Int32 Top level organization of a sport
gameType optional.Interface of GameTypeEnum Type of Game. Available types in /api/v1/gameTypes
trackingSystemOwner optional.Interface of TrackingSystemOwner Owner of the tracking system
season optional.String Season of play
sortBy optional.String Sort the set of data by the specified field
limit optional.Int32 Number of results to return
offset optional.Int32 The pointer to start for a return set; used for pagination

Return type

AnalyticsPlayMetadataWrapperRestObject

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GameGuidsFromPostgresRangeByGame

AnalyticsGameMetadataWrapperRestObject GameGuidsFromPostgresRangeByGame(ctx, optional) Get all games by updated date.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
optional *AnalyticsApiGameGuidsFromPostgresRangeByGameOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a AnalyticsApiGameGuidsFromPostgresRangeByGameOpts struct

Name Type Description Notes
fields **optional.Interface of []string** Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
gameModeId optional.Int32 Statcast game mode. Format: 0 = Batting Practive, 1 = Warmup 2 = Live
isPitch optional.Bool If there was a pitch
isHit optional.Bool If there was a hit ball tracked
isPickoff optional.Bool If there was a pickoff
isNonStatcast optional.Bool If non statcast games need to be included
gamedayType optional.String Indicates the level of Gameday (tracking, play-by-play, linescore, etc...)
hasUpdates optional.Bool True if updated by an auditor
lastPlayTime optional.Time Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ
lastVideoUpdatedTime optional.Time The last time SportyBot video was updated
lastUpdatedTime optional.Time Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
lastMetricsUpdatedTime optional.Time Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
lastAuditUpdatedTime optional.Time Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
gameDate optional.String Date of Game. Format: YYYY-MM-DD
sportId optional.Int32 Top level organization of a sport
gameType optional.Interface of GameTypeEnum Type of Game. Available types in /api/v1/gameTypes
season optional.String Season of play
trackingSystemOwner optional.Interface of TrackingSystemOwner Owner of the tracking system
sortBy optional.String Sort the set of data by the specified field
limit optional.Int32 Number of results to return
offset optional.Int32 The pointer to start for a return set; used for pagination
scheduleEventTypes **optional.Interface of []ScheduleEventTypes** Comma delimited list of type of event types

Return type

AnalyticsGameMetadataWrapperRestObject

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GameLastPitch

[]AnalyticsPlayMetadataRestObject GameLastPitch(ctx, gamePks, optional) Get the last pitch for a list of games

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
gamePks **[]int32** Unique Primary Key Representing a Game
optional *AnalyticsApiGameLastPitchOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a AnalyticsApiGameLastPitchOpts 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

**[]AnalyticsPlayMetadataRestObject**

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

[Back to top] [Back to API list] [Back to Model list] [Back to README]

HomeRunBallparks

VenuesRestObject HomeRunBallparks(ctx, gamePk, guid, isHomeRunParks, optional) Get if the play is a home run is each park for a specific play.

Returns a json file containing raw coordinate data and refined calculated metrics.

This responses can be very large, so it is strongly recommended that you pass "Accept-Encoding: gzip" as a header to have the responses compressed.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
gamePk int32 Unique Primary Key Representing a Game
guid string Unique identifier for a play within a game
isHomeRunParks bool
optional *AnalyticsApiHomeRunBallparksOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a AnalyticsApiHomeRunBallparksOpts 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

VenuesRestObject

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ParsedJsonFormattedAnalytics

AnalyticsRestObject ParsedJsonFormattedAnalytics(ctx, gamePk, guid, optional) Get Statcast data for a specific play.

Returns a json file containing raw coordinate data and refined calculated metrics.

This responses can be very large, so it is strongly recommended that you pass "Accept-Encoding: gzip" as a header to have the responses compressed.

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
gamePk int32 Unique Primary Key Representing a Game
guid string Unique identifier for a play within a game
optional *AnalyticsApiParsedJsonFormattedAnalyticsOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a AnalyticsApiParsedJsonFormattedAnalyticsOpts 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

AnalyticsRestObject

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json;charset=UTF-8

[Back to top] [Back to API list] [Back to Model list] [Back to README]