-
Notifications
You must be signed in to change notification settings - Fork 11
Data Types: Team
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
- The record of the team. Dataclass: 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
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 |
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 |
Description: Return Team Id(s) from team_name
Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
team_name |
string | Yes | Search team name | |
search_key |
string | No | Search key | 'name' |
Other Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
sportId |
string/int | No | sport id number for team search. |
Description: Return all Coaches from team_id
Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
team_id |
string/int | Yes | unique team id of team |
Other Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
season |
string/int | Yes | Insert year to return a directory of players based on roster status for a particular club in a specific season. | |
date |
string | Yes | unique team id of team | |
fields |
string/int | Yes | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
Description: Return all Player Objects from team_id
Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
team_id |
string/int | Yes | unique team id of team |
Other Parameters:
Name | Type | Required | Description | Default |
---|---|---|---|---|
team_id |
string/int | Yes | unique team id of team | |
rosterType |
string | Yes | Insert teamId to return a directory of players based on roster status for a particular club. rosterType's include 40Man, fullSeason, fullRoster, nonRosterInvitees, active, allTime, depthChart, and gameday. | |
season |
string/int | Yes | Insert year to return a directory of players based on roster status for a particular club in a specific season. | |
date |
string | Yes | unique team id of team | |
fields |
string/int | Yes | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
https://statsapi.mlb.com/api/v1/teams?sportId=1
>>> import mlbstatsapi
>>>
>>> mlb = mlbstatsapi.Mlb()
>>>
>>> team_id = mlb.get_team_id("Seattle Mariners")
>>> print(team_id)
[136]
>>>
>>> team = mlb.get_team(team_ids[0])
>>> print(team)
Team(id=136, link=/api/v1/teams/136, name=Seattle Mariners, springleague=League(id=114, link=/api/v1/league/114, name=Cactus League), allstarstatus=N, season=2022, venue=Venue(id=680, link=/api/v1/venues/680, name=T-Mobile Park), springvenue=Venue(id=2530, link=/api/v1/venues/2530, name=None), teamcode=sea, filecode=sea, abbreviation=SEA, teamname=Mariners, locationname=Seattle, firstyearofplay=1977, league=League(id=103, link=/api/v1/league/103, name=American League), division=Division(id=200, link='/api/v1/divisions/200', name='American League West', season=None, nameshort=None, abbreviation=None, league=None, sport=None, haswildcard=None, sortorder=None, numplayoffteams=None, active=None), sport=Sport(id=1, link=/api/v1/sports/1), shortname=Seattle, franchisename=Seattle, clubname=Mariners, active=True)
>>>
>>>
>>> roster = mlb.get_team_roster(team_ids[0])
>>> print(roster)
[Player(), Player(), Player()]
>>>
>>> coaches = mlb.get_team_coaches(team_ids[0])
>>> print(coaches)
[Coach(), Coach(), Coach()]
>>>
Note: This information is provided for reference only, without warranty or guarantee, and is not official documentation provided by MLB. This package and its author are not affiliated with MLB or any MLB team. This API wrapper interfaces with MLB's Stats API. Use of MLB data is subject to the notice posted at http://gdx.mlb.com/components/copyright.txt.