League resource

Description

When users join a Fantasy Football, Baseball, Basketball, or Hockey draft and trade game, they are organized into leagues with a limited number of friends or other Yahoo! users, with each user managing a Team. With the League API, you can obtain the league related information, like the league name, the number of teams, the draft status, et cetera. Leagues only exist in the context of a particular Game, although you can request a League Resource as the base of your URI by using the global league_key. A particular user can only retrieve data for private leagues of which they are a member, or for public leagues.

HTTP Operations Supported

  • GET

URIs

http://fantasysports.yahooapis.com/fantasy/v2/league/{league_key}

Any sub-resource under a league is extracted using a URI like:

http://fantasysports.yahooapis.com/fantasy/v2/league/{league_key}/{sub_resource}

Multiple sub-resources can be extracted from league in the same URI using a format like:

http://fantasysports.yahooapis.com/fantasy/v2/league/{league_key};out={sub_resource_1},{sub_resource_2}

League key format

{game_key}.l.{league_id}

Example: pnfl.l.431 or 223.l.431

Note

The separator between the game_key and league_id is a lower case L (not the number 1).

Sub-resources

Default sub-resource: metadata

Name Description URI Sample
metadata Includes league key, id, name, url, draft status, number of teams, and current week information. /fantasy/v2/league/{league_key}/metadata

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431

settings League settings. For instance, draft type, scoring type, roster positions, stat categories and modifiers, divisions. /fantasy/v2/league/{league_key}/settings

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/settings

standings Ranking of teams within the league. Accepts Teams as a sub-resource, and includes team_standings data by default beneath the teams /fantasy/v2/league/{league_key}/standings

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/standings

scoreboard League scoreboard. Accepts Matchups as a sub-resource, which in turn accept Teams as a sub-resource. Includes team_stats data by default.

Scoreboard for current week: /fantasy/v2/league/{league_key}/scoreboard

Scoreboard for a particular week: /fantasy/v2/league/{league_key}/scoreboard;week={week}

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/scoreboard;week=2

teams All teams in the league. /fantasy/v2/league/{league_key}/teams

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/teams

players The league's eligible players. /fantasy/v2/league/{league_key}/players

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/players

draftresults Draft results for all teams in the league. /fantasy/v2/league/{league_key}/draftresults

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/draftresults

transactions League transactions -- adds, drops, and trades. /fantasy/v2/league/{league_key}/transactions

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/transactions

Sample XML

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/settings

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/standings

http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/scoreboard

Table of Contents