-
Notifications
You must be signed in to change notification settings - Fork 14
League
Patrick McFarlane edited this page Sep 29, 2022
·
10 revisions
This section details all endpoints accessible via the League
class in league.py. Endpoints available include:
Endpoint | Description | Tables |
---|---|---|
alltimeleadersgrids | All time leaders across various metrics | GPLeaders, PTSLeaders, ASTLeaders, STLLeaders, OREBLeaders, DREBLeaders, REBLeaders, BLKLeaders, FGMLeaders, FGALeaders, FG_PCTLeaders, TOVLeaders, FG3MLeaders, FG3ALeaders, FG3_PCTLeaders, PFLeaders, FTMLeaders, FTALeaders, FT_PCTLeaders |
commonallplayers | Current roster information if the current_season flag is '1', historical player information if the current_season flag is '0' | CommonAllPlayers |
commonteamyears | Start and end dates for teams in league history | TeamYears |
commonplayoffseries | Playoff series matchup breakdown by game | PlayoffSeries |
franchisehistory | Current and defunct franchise histories, including performance and franchise metadata | FranchiseHistory, DefunctTeams |
leaguegamelog | Game logs for players or teams across the league | LeagueGameLog |
playerindex | Historical player metadata for all players in league history | PlayerIndex |
playoffpicture | Current state of the playoff picture by conference | EastConfPlayoffPicture, WestConfPlayoffPicture, EastConfStandings, WestConfStandings, EastConfRemainingGames, WestConfRemainingGames |
The League
endpoints require the corresponding parameters below:
API Param | Class Param | Definition | Valid Values | Required |
---|---|---|---|---|
LeagueID | league_id | String of a two-digit number corresponding to the league. '00' is the NBA, '10' is the WNBA, '01' is the ABA, and '20' is the G-League | '00', '01', '10', '20' | All |
Season | season | String of a two-year season in a YYYY-ZZ format, where the ZZ are the last two digits of the following year. For example, '2017-18' is a valid value of season and represents the 2017-18 NBA season | 'YYYY-ZZ' | 'commonallplayers', 'commonplayoffseries', 'playerindex', 'leaguegamelog' |
SeasonID | season_id | String of a year season in a XYYYY format. X indicates the season type ('1' for preseason, '2' for regular season, '4' for the playoffs). For example, '22017' is a valid value of season_id and represents the 2017-18 NBA regular season. season_id is required by the 'playoffpicture' endpoint. | 'XYYYY' | 'playoffpicture' |
IsOnlyCurrentSeason | current_season | Boolean value ('1' or '0') indicating whether only the current season should be returned ('1'). A value of '0' returns all players in league history | '0', '1' | 'commonallplayers' |
College | college | College that a player attended | 'playerindex' | |
Country | country | Home country for a player | 'playerindex' | |
DraftPick | draft_pick | Overall pick number at which a player was drafted | '1'-'60' | 'playerindex' |
DraftRound | draft_round | Round in which a player was drafted | '1', '2' | 'playerindex' |
DraftYear | draft_year | Year in which a player was drafted | 'playerindex' | |
Height | height | Player height | 'playerindex' | |
Weight | weight | Player weight | 'playerindex' | |
Historical | historical | Boolean indicator whether to return historical players | '0', '1' | 'playerindex' |
SeasonType | season_type | String indicating the type of season for data to be returned | 'Regular Season', 'Pre Season', 'Playoffs', 'All Star' | 'playerindex', 'alltimeleadersgrids', 'leaguegamelog' |
TeamID | team_id | String of a 10-digit integer that uniquely identifies a team for which data is to be returned | 'playerindex' | |
PerMode | per_mode | String indicating the type of rate stats to be returned | 'Totals', 'PerGame', 'MinutesPer', 'Per48', 'Per40', 'Per36', 'PerMinute', 'PerPossession', 'PerPlay', 'Per100Possessions', 'Per100Plays' | 'alltimeleadersgrids' |
TopX | top_x | Number of stat leaders to return | 'alltimeleadersgrids' | |
DateFrom | date_from | String of a date in a MM/DD/YYYY format indicating the start date for which data is to be returned | 'leaguegamelog' | |
DateTo | date_to | String of a date in a MM/DD/YYYY format indicating the end date for which data is to be returned | 'leaguegamelog' | |
Direction | direction | Direction of sorting | 'ASC', 'DESC' | 'leaguegamelog' |
PlayerOrTeam | player_or_team | Indicator to return stats for a player or team | 'P', 'T' | 'leaguegamelog' |
Sorter | sorter | Field by which data will be sorted | 'leaguegamelog' |
The following table contains features returned in each table from all endpoints:
Column | Definition | Endpoint/Table |
---|---|---|
ABBREVIATION | Abbreviated team name | commonteamyears/TeamYears |
AST | Assists | playerindex/PlayerIndex, alltimeleadersgrids/ASTLeaders, leaguegamelog/LeagueGameLog |
AST_RANK | Assists rank | alltimeleadersgrids/ASTLeaders |
AWAY | Record on the road | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
BLK | Blocks | alltimeleadersgrids/BLKLeaders, leaguegamelog/LeagueGameLog |
BLK_RANK | Blocks rank | alltimeleadersgrids/BLKLeaders |
CLINCHED_CONFERENCE | Boolean indicating if conference is clinched | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
CLINCHED_DIVISION | Boolean indicating if division is clinched | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
CLINCHED_PLAYOFFS | Boolean indicating if playoffs are clinched | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
COLLEGE | College a player attended | playerindex/PlayerIndex |
CONF | Conference record | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
CONFERENCE | Conference | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture, playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
CONF_TITLES | Number of conference titles | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams |
COUNTRY | Home country of a player | playerindex/PlayerIndex |
DISPLAY_FIRST_LAST | Player full name | commonallplayers/CommonAllPlayers |
DISPLAY_LAST_COMMA_FIRST | Player last, first name | commonallplayers/CommonAllPlayers |
DIV | Division record | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
DIV_TITLES | Number of division titles | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams |
DRAFT_NUMBER | Overall pick number at which a player was drafted | playerindex/PlayerIndex |
DRAFT_ROUND | Round in which a player was drafted | playerindex/PlayerIndex |
DRAFT_YEAR | Year in which a player was drafted | playerindex/PlayerIndex |
DREB | Defensive rebounds | alltimeleadersgrids/DREBLeaders, leaguegamelog/LeagueGameLog |
DREB_RANK | Defensive rebounds rank | alltimeleadersgrids/DREBLeaders |
ELIMINATED_PLAYOFFS | Boolean indicating elimination from making the playoffs | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
END_YEAR | Final year of franchise | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams |
FANTASY_PTS | Fantasy points | leaguegamelog/LeagueGameLog |
FG3A | Three-point field goal attempts | alltimeleadersgrids/FG3ALeaders, leaguegamelog/LeagueGameLog |
FG3A_RANK | Three-point field goal attempts rank | alltimeleadersgrids/FG3ALeaders |
FG3M | Three-point field goals made | alltimeleadersgrids/FG3MLeaders, leaguegamelog/LeagueGameLog |
FG3M_RANK | Three-point field goals made rank | alltimeleadersgrids/FG3MLeaders |
FG3_PCT | Three-point field goal percentage | alltimeleadersgrids/FG3_PCTLeaders, leaguegamelog/LeagueGameLog |
FG3_PCT_RANK | Three-point field goal percentage rank | alltimeleadersgrids/FG3_PCTLeaders |
FGA | Field goal attempts | alltimeleadersgrids/FGALeaders, leaguegamelog/LeagueGameLog |
FGA_RANK | Field goal attempts rank | alltimeleadersgrids/FGALeaders |
FGM | Field goals made | alltimeleadersgrids/FGMLeaders, leaguegamelog/LeagueGameLog |
FGM_RANK | Field goals made rank | alltimeleadersgrids/FGMLeaders |
FG_PCT | Field goal percentage | alltimeleadersgrids/FG_PCTLeaders, leaguegamelog/LeagueGameLog |
FG_PCT_RANK | Field goal percentage rank | alltimeleadersgrids/FG_PCTLeaders |
FROM_YEAR | First year on team | commonallplayers/CommonAllPlayers, playerindex/PlayerIndex |
FTA | Free throw attempts | alltimeleadersgrids/FTALeaders, leaguegamelog/LeagueGameLog |
FTA_RANK | Free throw attempts rank | alltimeleadersgrids/FTALeaders |
FTM | Free throws made | alltimeleadersgrids/FTMLeaders, leaguegamelog/LeagueGameLog |
FTM_RANK | Free throws made rank | alltimeleadersgrids/FTMLeaders |
FT_PCT | Free throw percentage | alltimeleadersgrids/FT_PCTLeaders, leaguegamelog/LeagueGameLog |
FT_PCT_RANK | Free throw percentage rank | alltimeleadersgrids/FT_PCTLeaders |
GAMES | Number of games played | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams |
GAME_DATE | Date on which a game is played | leaguegamelog/LeagueGameLog |
GAME_ID | Unique game identifier | commonplayoffseries/PlayoffSeries, leaguegamelog/LeagueGameLog |
GAME_NUM | Series game number | commonplayoffseries/PlayoffSeries |
GAMES_PLAYED_FLAG | Boolean ('Y' or 'N') indicating if games were played | commonallplayers/CommonAllPlayers |
GB | Games back | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
GP | Games played | alltimeleadersgrids/GPLeaders |
GP_RANK | Rank of games played | alltimeleadersgrids/GPLeaders |
GR_OVER_500 | Games remaining against teams over .500 | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
GR_OVER_500_AWAY | Road games remaining against teams over .500 | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
GR_OVER_500_HOME | Home games remaining against teams over .500 | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
GR_UNDER_500 | Games remaining against teams under .500 | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
GR_UNDER_500_AWAY | Road games remaining against teams under .500 | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
GR_UNDER_500_HOME | Home games remaining against teams under .500 | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
HEIGHT | Player height | playerindex/PlayerIndex |
HIGH_SEED_RANK | Playoff rank of the higher seed | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
HIGH_SEED_SERIES_L | High seed series losses | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
HIGH_SEED_SERIES_REMAINING_AWAY_G | High seed remaining series away games | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
HIGH_SEED_SERIES_REMAINING_G | High seed remaining series games | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
HIGH_SEED_SERIES_REMAINING_HOME_G | High seed remaining series home games | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
HIGH_SEED_SERIES_W | High seed series wins | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
HIGH_SEED_TEAM | High seed team name | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
HIGH_SEED_TEAM_ID | High seed unique team identifier | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
HOME | Record at home | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
HOME_TEAM_ID | Unique identifier of the home team | commonplayoffseries/PlayoffSeries |
IS_ACTIVE_FLAG | Boolean indicating if a player is active | alltimeleadersgrids/GPLeaders, alltimeleadersgrids/PTSLeaders, alltimeleadersgrids/ASTLeaders, alltimeleadersgrids/STLLeaders, alltimeleadersgrids/OREBLeaders, alltimeleadersgrids/DREBLeaders, alltimeleadersgrids/REBLeaders, alltimeleadersgrids/BLKLeaders, alltimeleadersgrids/FGMLeaders, alltimeleadersgrids/FGALeaders, alltimeleadersgrids/FG_PCTLeaders, alltimeleadersgrids/TOVLeaders, alltimeleadersgrids/FG3MLeaders, alltimeleadersgrids/FG3ALeaders, alltimeleadersgrids/FG3_PCTLeaders, alltimeleadersgrids/PFLeaders, alltimeleadersgrids/FTMLeaders, alltimeleadersgrids/FTALeaders, alltimeleadersgrids/FT_PCTLeaders |
IS_DEFUNCT | Boolean indicating if a team is defunct | playerindex/PlayerIndex |
JERSEY_NUMBER | Jersey number for a player | playerindex/PlayerIndex |
LEAGUE_ID | String of a two-digit number corresponding to the league | commonteamyears/TeamYears, franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams |
LEAGUE_TITLES | Number of league titles | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams |
LOSSES | Losses | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams, playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
LOW_SEED_RANK | Playoff rank of the lower seed | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
LOW_SEED_TEAM | Low seed team name | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
LOW_SEED_TEAM_ID | Low seed unique team identifier | playoffpicture/EastConfPlayoffPicture, playoffpicture/WestConfPlayoffPicture |
MATCHUP | String of teams playing each other | leaguegamelog/LeagueGameLog |
MAX_YEAR | Team end year | commonteamyears/TeamYears |
MIN | Minutes played | leaguegamelog/LeagueGameLog |
MIN_YEAR | Team origin year | commonteamyears/TeamYears |
OREB | Offensive rebounds | alltimeleadersgrids/OREBLeaders, leaguegamelog/LeagueGameLog |
OREB_RANK | Offensive rebounds rank | alltimeleadersgrids/OREBLeaders |
PCT | Winning percentage | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
PERSON_ID | Unique person identifier | commonallplayers/CommonAllPlayers, playerindex/PlayerIndex |
PF | Personal fouls | alltimeleadersgrids/PFLeaders, leaguegamelog/LeagueGameLog |
PF_RANK | Personal fouls rank | alltimeleadersgrids/PFLeaders |
PLAYERCODE | Alternative unique player identifier | commonallplayers/CommonAllPlayers |
PLAYER_FIRST_NAME | First name of a player | playerindex/PlayerIndex |
PLAYER_ID | Unique player identifier | alltimeleadersgrids/GPLeaders, alltimeleadersgrids/PTSLeaders, alltimeleadersgrids/ASTLeaders, alltimeleadersgrids/STLLeaders, alltimeleadersgrids/OREBLeaders, alltimeleadersgrids/DREBLeaders, alltimeleadersgrids/REBLeaders, alltimeleadersgrids/BLKLeaders, alltimeleadersgrids/FGMLeaders, alltimeleadersgrids/FGALeaders, alltimeleadersgrids/FG_PCTLeaders, alltimeleadersgrids/TOVLeaders, alltimeleadersgrids/FG3MLeaders, alltimeleadersgrids/FG3ALeaders, alltimeleadersgrids/FG3_PCTLeaders, alltimeleadersgrids/PFLeaders, alltimeleadersgrids/FTMLeaders, alltimeleadersgrids/FTALeaders, alltimeleadersgrids/FT_PCTLeaders, leaguegamelog/LeagueGameLog |
PLAYER_LAST_NAME | Last name of a player | playerindex/PlayerIndex |
PLAYER_NAME | Name of a player | alltimeleadersgrids/GPLeaders, alltimeleadersgrids/PTSLeaders, alltimeleadersgrids/ASTLeaders, alltimeleadersgrids/STLLeaders, alltimeleadersgrids/OREBLeaders, alltimeleadersgrids/DREBLeaders, alltimeleadersgrids/REBLeaders, alltimeleadersgrids/BLKLeaders, alltimeleadersgrids/FGMLeaders, alltimeleadersgrids/FGALeaders, alltimeleadersgrids/FG_PCTLeaders, alltimeleadersgrids/TOVLeaders, alltimeleadersgrids/FG3MLeaders, alltimeleadersgrids/FG3ALeaders, alltimeleadersgrids/FG3_PCTLeaders, alltimeleadersgrids/PFLeaders, alltimeleadersgrids/FTMLeaders, alltimeleadersgrids/FTALeaders, alltimeleadersgrids/FT_PCTLeaders, leaguegamelog/LeagueGameLog |
PLAYER_SLUG | Unique part of web address for a player's page | playerindex/PlayerIndex |
PLUS_MINUS | leaguegamelog/LeagueGameLog | |
PTS | Points | playerindex/PlayerIndex, alltimeleadersgrids/PTSLeaders, leaguegamelog/LeagueGameLog |
PTS_RANK | Points rank | alltimeleadersgrids/PTSLeaders |
POSITION | Player position | playerindex/PlayerIndex |
PO_APPEARANCES | Number of playoff appearances | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams |
RANK | Standings ranking | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
RANKING_CRITERIA | Criteria used for standings ranking | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
REB | Rebounds | playerindex/PlayerIndex, alltimeleadersgrids/REBLeaders, leaguegamelog/LeagueGameLog |
REB_RANK | Rebounds rank | alltimeleadersgrids/REBLeaders |
REMAINING_AWAY_G | Remaining away games | playoffpicture/EastConfRemainingGames, playoffpicture/WestConfRemainingGames |
REMAINING_G | Remaining games | playoffpicture/EastConfRemainingGames, playoffpicture/WestConfRemainingGames |
REMAINING_HOME_G | Remaining home games | playoffpicture/EastConfRemainingGames, playoffpicture/WestConfRemainingGames |
ROSTERSTATUS | Roster status | commonallplayers/CommonAllPlayers |
ROSTER_STATUS | Roster status | playerindex/PlayerIndex |
SEASON_ID | Unique season identifier | leaguegamelog/LeagueGameLog |
SERIES_ID | Unique series identifier | commonplayoffseries/PlayoffSeries |
SOSA_REMAINING | Winning percentage of remaining opponents | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
START_YEAR | First year of franchise | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams |
STATS_TIMELINE | Timeline covered by stats | playerindex/PlayerIndex |
STL | Steals | alltimeleadersgrids/STLLeaders, leaguegamelog/LeagueGameLog |
STL_RANK | Steals rank | alltimeleadersgrids/STLLeaders |
TEAM | Team name | playoffpicture/EastConfStandings, playoffpicture/WestConfStandings, playoffpicture/EastConfRemainingGames, playoffpicture/WestConfRemainingGames |
TEAM_ABBREVIATION | Abbreviated team name | commonallplayers/CommonAllPlayers, playerindex/PlayerIndex, leaguegamelog/LeagueGameLog |
TEAM_CITY | Team city | commonallplayers/CommonAllPlayers, franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams, playerindex/PlayerIndex |
TEAM_CODE | Alternative unique team identifier | commonallplayers/CommonAllPlayers |
TEAM_ID | Unique team identifier | commonallplayers/CommonAllPlayers, commonteamyears/TeamYears, franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams, playoffpicture/EastConfStandings, playoffpicture/WestConfStandings, playoffpicture/EastConfRemainingGames, playoffpicture/WestConfRemainingGames, playerindex/PlayerIndex, leaguegamelog/LeagueGameLog |
TEAM_NAME | Team name | commonallplayers/CommonAllPlayers, franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams, playerindex/PlayerIndex, leaguegamelog/LeagueGameLog |
TEAM_SLUG | Unique part of a web address for a team | playerindex/PlayerIndex |
TOV | Turnovers | alltimeleadersgrids/TOVLeaders, leaguegamelog/LeagueGameLog |
TOV_RANK | Turnovers rank | alltimeleadersgrids/TOVLeaders |
TO_YEAR | Last year on team | commonallplayers/CommonAllPlayers, playerindex/PlayerIndex |
VIDEO_AVAILABLE | Boolean indicating if video is available | leaguegamelog/LeagueGameLog |
VISITOR_TEAM_ID | Unique identifier of the away team | commonplayoffseries/PlayoffSeries |
WEIGHT | Player weight | playerindex/PlayerIndex |
WINS | Wins | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams, playoffpicture/EastConfStandings, playoffpicture/WestConfStandings |
WIN_PCT | Winning percentage | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams |
WL | 'W' for win, 'L' for loss | leaguegamelog/LeagueGameLog |
YEARS | Age in years of franchise | franchisehistory/FranchiseHistory, franchisehistory/DefunctTeams |