Skip to content

Data Types: Awards

MattsFace edited this page Dec 30, 2022 · 9 revisions

Award Structure

Attributes are expandable and collapsable - Link to award dataclass

id : str
  • Award id
name : str
  • Name of the award
date : str
  • Date of when award was given
season : str
  • Season award is for/from
team : Team
  • Team award was to/ Player is from. Dataclass: Team
id : int
  • id number of the team
link : str
  • The API link for the team
player : Person
  • Person award is for. Dataclass: Person
id : int
  • id number of the person
link : str
  • link to person
primaryPosition : Position
code: str
  • code number of the Position
name: str
  • the name of the Position
type: str
  • the type of the Position
abbreviation: str
  • the abbreviation of the Position
namefirstlast : str
  • The first and last name of the Person
notes : str None
  • Any notes associated with award
votes : int None
  • Votes for award

Usage that returns Award objects

get_awards

Description: Return a list of awards

Parameters:

Name Type Required Description Default
award_id string Yes Insert a awardId to return a directory of players for a given award. None

Other Parameters:

Name Type Required Description Default
sportId string/int No Insert a sportId to return a directory of players for a given award in a specific sport. None
leagueId string/int No Insert leagueId(s) to return a directory of players for a given award in a specific league. Format '103,104' None
season string/int No Insert year(s) to return a directory of players for a given award in a given season. Format '2016,2017' None

Example output from MLB stats api endpoint

Mlb stats api Query:

https://statsapi.mlb.com/api/v1/awards/MLBHOF/recipients?sportId=1&season=2017&leagueId=103

Equivelant with python-mlb-statsapi:

>>> import mlbstatsapi
>>>
>>> mlb = mlbstatsapi.Mlb()
>>>
>>> awards = mlb.get_awards(award_id = 'MLBHOF', sportId = 1, season = 2017, leagueId = 103)
>>>
>>> print(awards)
[Award(id=MLBHOF, name=Hall Of Fame, date=2017-01-18, season=2017, team=Team(id=140, link=/api/v1/teams/140), player=Person(id=121358, link=/api/v1/people/121358, primaryposition=Position(code='2', name='Catcher', type='Catcher', abbreviation='C'), namefirstlast=Ivan Rodriguez), votes=336), Award(id=MLBHOF, name=Hall Of Fame, date=2017-01-18, season=2017, team=Team(id=117, link=/api/v1/teams/117), player=Person(id=110432, link=/api/v1/people/110432, primaryposition=Position(code='3', name='First Base', type='Infielder', abbreviation='1B'), namefirstlast=Jeff Bagwell), votes=381), Award(id=MLBHOF, name=Hall Of Fame, date=2017-01-18, season=2017, team=Team(id=120, link=/api/v1/teams/120), player=Person(id=120891, link=/api/v1/people/120891, primaryposition=Position(code='7', name='Outfielder', type='Outfielder', abbreviation='LF'), namefirstlast=Tim Raines), votes=380)]