Skip to content

Data Types: Venue

MattsFace edited this page Dec 29, 2022 · 4 revisions

Venue Structure

Attributes are expandable and collapsable - Link to Venue dataclass

id : int
  • id for this venue
name : str
  • Name for this venue
link : str
  • Link to venues endpoint
location : Location
  • Location for this venue. Dataclass: Location
address1 : str
  • Venues first address line
address2 : str
  • Venues second address line
city : str
  • City the venue is in
state : str
  • The State the venue is in
stateAbbrev : str
  • The staes abbreviation
postalCode : str
  • Postal code for this venue
defaultCoordinates : VenueDefaultCoordinates
latitude : float
  • The latatude coordinate for this venue
longitude : float
  • The longitude coordinate for this venue
country : str
  • What country this venue is in
phone : str
  • Phone number for this venue
timezone : TimeZone
  • Timezone for this venue. Dataclass: TimeZone
id : str
  • id string for a venues timezone
offset : int
  • The offset for this timezone from
tz : str
  • Timezone string
fieldinfo : FieldInfo
  • Info on this venue's field. Dataclass: FieldInfo
capacity : int
  • Capacity for this venue
turfType : str
  • The type of turf in this venue
roofType : str
  • What kind of roof for this venue
leftLine : int
  • Distance down the left line
left : int
  • Distance to left
leftCenter : int
  • Distance to left center
center : int
  • Distance to center
rightCenter : int
  • Distance to right center
right : int
  • Distance to right
rightLine : int
  • Distance to right line
active : bool
  • Is this field currently active

Usage that returns Venue objects

get_venue

Description: Returns venue directorial information for all available venues in the Stats API.

Parameters:

Name Type Required Description Default
venue_id string/int Yes venueId to return venue directorial information based venueId.

Other Parameters:

Name Type Required Description Default
fields string Yes Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute

get_venues

Description: Return all venues

Other Parameters:

Name Type Required Description Default
venueIds int/list No Insert venueId to return venue directorial information based venueId.
sportIds string/int No Insert sportIds to return venue directorial information based a given sport(s). For a list of all sports: https://statsapi.mlb.com/api/v1/sports
season string/int No Insert year to return venue directorial information for a given season.
fields string No Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute

get_venue_id


Description: Return venue id

Parameters:

Name Type Required Description Default
venue_name string/int Yes venue name.
search_key string/int No venue name. name

Example output from MLB stats api endpoint

Mlb stats api Query:

https://statsapi.mlb.com/api/v1/venues?venueIds=15

Equivelant with python-mlb-statsapi:

>>> import mlbstatsapi
>>> 
>>> mlb = mlbstatsapi.Mlb()
>>>
>>> venue_ids = mlb.get_venue_id("PNC Park")
[31]
>>>
>>> venue = mlb.get_venue(venue_ids[0])
>>>
>>> print(venue)
Venue(id=31, link=/api/v1/venues/31, name=PNC Park, fieldinfo=FieldInfo(capacity=38753, turftype=Grass, rooftype=Open, leftline=325, left=389, leftcenter=410, center=399, rightcenter=375, rightline=320), active=True)