yahoo fantasy api

games.fetch

Retrieve information about multiple games in a single request for the current logged in user.

Description
Tester

Arguments

Filters
Description
is_available
Use `1` to only show games that are in season.
game_types
Choose from the following (comma separated for multiple):
  • full
  • pickem-team
  • pickem-group
  • pickem-team-list
game_codes
Game codes are simply game keys for the game you want to query. You can find a list of common game_ids in the official Yahoo! Fantasy Sports documentation for the game resource. Game key examples: 'mlb', 'nfl', 328 (2014 MLB season), 242 (2010 NFL season). Comma separated for multiple.
seasons
Any valid seasons. Comma separated for multiple.
Subresource
Description
game_weeks
Retrieve the game weeks for the retrieved games.
stat_categories
Retrieve the stat categories for the retrieved games.
position_types
Retrieve the position types for the retrieved games.
roster_positions
Retrieve the roster positions for the retrieved games.

How to use

const YahooFantasy = require('yahoo-fantasy');
const yf = new YahooFantasy(
  Y!APPLICATION_KEY,
  Y!APPLICATION_SECRET,
  tokenCallbackFn, // optional
  redirectUri // optional
);

yf.setUserToken(
  Y!OAuthAccessToken
);

// promise based
try {
  const games = await yf.games.user(
    {filters}, // optional
    [subresources], // optional
  );
} catch (e) {
  // handle error
}

// callback based
yf.games.user(
  {filters}, // optional 
  [subresources], // optional
  callbackFn
);

Sample Response

[
  {
    "game_key": "308",
    "game_id": "308",
    "name": "Baseball",
    "code": "mlb",
    "type": "full",
    "url": "http://baseball.fantasysports.yahoo.com/b1",
    "season": "2013",
    "leagues": [
      {
        "league_key": "308.l.5853",
        "league_id": "5853",
        "name": "FKL Baseball - Season VII",
        "url": "http://baseball.fantasysports.yahoo.com/archive/mlb/2013/5853",
        "league_chat_id": "",
        "draft_status": "postdraft",
        "num_teams": 13,
        "edit_key": "2015-02-04",
        "weekly_deadline": "intraday",
        "league_update_timestamp": "1380528581",
        "scoring_type": "point",
        "league_type": "private",
        "renew": "268_26677",
        "renewed": "328_24281",
        "short_invitation_url": false,
        "is_pro_league": "0",
        "start_date": "2013-03-31",
        "end_date": "2013-09-29",
        "is_finished": 1
      },
      {
        "league_key": "308.l.51222",
        "league_id": "51222",
        "name": "Freddy Beach Baseball",
        "url": "http://baseball.fantasysports.yahoo.com/archive/mlb/2013/51222",
        "password": "fantasyb",
        "league_chat_id": "",
        "draft_status": "postdraft",
        "num_teams": 12,
        "edit_key": "2015-02-04",
        "weekly_deadline": "intraday",
        "league_update_timestamp": "1380528992",
        "scoring_type": "head",
        "league_type": "private",
        "renew": "268_46504",
        "renewed": "328_34014",
        "short_invitation_url": false,
        "is_pro_league": "0",
        "current_week": "25",
        "start_week": "1",
        "start_date": "2013-03-31",
        "end_week": "25",
        "end_date": "2013-09-29",
        "is_finished": 1
      }
    ],
    "teams": [
      {
        "team_key": "308.l.5853.t.2",
        "team_id": "2",
        "name": "ChicksDigTheLongBall",
        "is_owned_by_current_login": 1,
        "url": "http://baseball.fantasysports.yahoo.com/archive/mlb/2013/5853/2",
        "team_logo": "https://i.imgur-ysports.com/PhEXA9Ry.jpg",
        "waiver_priority": 8,
        "number_of_moves": "20",
        "number_of_trades": "3",
        "managers": [
          {
            "manager_id": "2",
            "nickname": "[REDACTED]",
            "guid": "RYWP7M53IC626MGOX36ZWCM4FA",
            "is_current_login": "1",
            "email": "[REDACTED]",
            "image_url": "https://s.yimg.com/wv/images/8ed931b36884df369fae061f758e1c43_64.jpg"
          }
        ]
      },
      {
        "team_key": "308.l.51222.t.1",
        "team_id": "1",
        "name": "ChicksDigTheLongBall",
        "is_owned_by_current_login": 1,
        "url": "http://baseball.fantasysports.yahoo.com/archive/mlb/2013/51222/1",
        "team_logo": "http://l.yimg.com/dh/ap/fantasy/img/mlb/icon_6_lg.gif",
        "waiver_priority": 9,
        "number_of_moves": "31",
        "number_of_trades": "1",
        "clinched_playoffs": 1,
        "managers": [
          {
            "manager_id": "1",
            "nickname": "[REDACTED]",
            "guid": "RYWP7M53IC626MGOX36ZWCM4FA",
            "is_commissioner": "1",
            "is_current_login": "1",
            "email": "[REDACTED]",
            "image_url": "https://s.yimg.com/wv/images/8ed931b36884df369fae061f758e1c43_64.jpg"
          }
        ]
      }
    ]
  },
  {
    "game_key": "321",
    "game_id": "321",
    "name": "Hockey",
    "code": "nhl",
    "type": "full",
    "url": "http://hockey.fantasysports.yahoo.com/hockey",
    "season": "2013",
    "leagues": [
      {
        "league_key": "321.l.63055",
        "league_id": "63055",
        "name": "theREDleague",
        "url": "http://hockey.fantasysports.yahoo.com/archive/nhl/2013/63055",
        "password": "",
        "league_chat_id": "",
        "draft_status": "postdraft",
        "num_teams": 11,
        "edit_key": "2015-02-04",
        "weekly_deadline": "intraday",
        "league_update_timestamp": "1397456678",
        "scoring_type": "point",
        "league_type": "private",
        "renew": "",
        "renewed": "341_21063",
        "short_invitation_url": "http://y.ahoo.it/xedvzlLA",
        "is_pro_league": "0",
        "start_date": "2013-10-01",
        "end_date": "2014-04-13",
        "is_finished": 1
      }
    ],
    "teams": [
      {
        "team_key": "321.l.63055.t.1",
        "team_id": "1",
        "name": "Kane't Get Enough",
        "is_owned_by_current_login": 1,
        "url": "http://hockey.fantasysports.yahoo.com/archive/nhl/2013/63055/1",
        "team_logo": "https://i.imgur-ysports.com/PhEXA9Ry.jpg",
        "waiver_priority": 8,
        "number_of_moves": "17",
        "number_of_trades": "3",
        "managers": [
          {
            "manager_id": "1",
            "nickname": "[REDACTED]",
            "guid": "RYWP7M53IC626MGOX36ZWCM4FA",
            "is_commissioner": "1",
            "is_current_login": "1",
            "email": "[REDACTED]",
            "image_url": "https://s.yimg.com/wv/images/8ed931b36884df369fae061f758e1c43_64.jpg"
          }
        ]
      }
    ]
  }
]