Skip to content

Data Types: Team

KCNilssen edited this page Dec 16, 2022 · 4 revisions

Team Structure

Attributes are expandable and collapsable - Link to Team dataclass

id : int
  • id number of the team
name : str
  • name of the team
link : str
  • The API link for the team
springleague : League
  • The spring league of the team. Dataclass: League
id : int
  • id number of the league
name : str
  • name of the league
link : str
  • link of the league
abbreviation : str
  • abbreviation the league
allstarstatus : str
  • The all status status of the team
season : str
  • The team's current season
venue : Venue
  • The team's home venue. Dataclass: Venue
id : int
  • id for this venue
name : str
  • Name for this venue
link : str
  • Link to venues endpoint
springvenue : Venue
  • The team's spring venue. Dataclass: Venue
id : int
  • id for this venue
link : str
  • Link to venues endpoint
teamcode : str
  • team code
filecode : str
  • filecode name of the team
abbreviation : str
  • The abbreviation of the team name
teamname : str
  • The team name
locationname : str
  • The location of the team
firstyearofplay : str
  • The first year the team began play
league : League
  • The league of the team. Dataclass: League
id : int
  • id number of the league
name : str
  • name of the league
link : str
  • link of the league
division : Division
  • The division the team is in. Dataclass: Division
id : int
  • id number of the divison
name : str
  • name of the division
link : str
  • link of the division
sport : Sport
  • The sport of the team. Dataclass: Sport
id : int
  • id number of the sport
name : str
  • name the sport
link : str
  • link of the sport
shortname : str
  • The shortname of the team
record : TeamRecord
gamesplayed : int
  • Number of game played by team
wildcardgamesback : str
  • Number of game back from wildcard
leaguegamesback : str
  • Number of league games back
springleaguegamesback : str
  • Number of game back in spring league
sportgamesback : str
  • Number of games back in sport
divisiongamesback : str
  • Number of games back in division
conferencegamesback : str
  • Number of games back in conference
leaguerecord : Dict
  • Record in league
records : Dict
  • Records
divisionleader : bool
  • Is this team a divison leader
wins : int
  • Number of wins
losses : int
  • Number of losses
winningpercentage : str
  • Winning percentage
franchisename : str
  • The franchisename of the team
clubname : str
  • The clubname of the team
active : str
  • Active status of the team
parentorgname : str
  • The name of the parent team or org
parentorgid : str
  • The id of the partent team or org

Usage that returns Team objects

get_team

Description: Return Team Object from Id

Parameters:

Name Type Required Description Default
team_id string/int Yes unique team id

Other Parameters:

Name Type Required Description Default
sportId string/int No Insert a sportId to return a directory of team information for a particular club in a sport.
season string/int No Insert year to return a directory of team information for a particular club in a specific season.
fields string No Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute

get_teams

Description: Return all Team Objects from sportId

Parameters:

Name Type Required Description Default
sport_id string/int Yes unique sport id of teams 1

Other Parameters:

Name Type Required Description Default
sportId string/int No Insert a sportId to return a directory of team information for a particular club in a sport.
season string/int No Insert year to return a directory of team information for a particular club in a specific season.
fields string No Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
leagueIds string/int No Insert leagueId to return team information for particular league.
activeStatus string No Insert activeStatus to populate a teams based on active/inactive status for a given season. There are three status types: Y, N, B
allStarStatuses string No Insert allStarStatuses to populate a teams based on Allstar status for a given season. There are two status types: Y and N
gameType string No Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute

Example output from MLB stats api endpoint

Mlb stats api Query:

https://statsapi.mlb.com/api/v1/teams?sportId=1

Equivelant with python-mlb-statsapi:

import mlbstatsapi

mlb = mlbstatsapi.Mlb()

mlb.get_teams(sport_id = 1)
Clone this wiki locally