yahoo fantasy api

team.matchups

Retrieve data regarding team matchups for each week of a season. Users must be authenticated and a member of the league to query against teams of private leagues.

Will only work for Head-to-Head style leagues.

Added the "weeks" param in v0.4.3.

Description
Tester

Arguments

Argument
Description
team_key
The key for the team you'd like to query. Team key format: {game_key}.l.{league_id}.t.{team_id}
week
The week number(s) you'd like the matchup for. If no weeks are specified, all matchups for the season will be returned.

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 matchups = await yf.team.matchups(
    team_key,
    [weeks] // optional
  );
} catch (e) {
  // handle error
}

// callback based
yf.team.matchups(
  team_key,
  [weeks], // optional
  callbackFn
);

Sample Response

{
  "team_key": "328.l.34014.t.1",
  "team_id": "1",
  "name": "ChicksDigTheLongBall",
  "url": "http://baseball.fantasysports.yahoo.com/b1/34014/1",
  "team_logo": "http://l.yimg.com/dh/ap/fantasy/img/mlb/icon_6_lg.gif",
  "waiver_priority": 4,
  "number_of_moves": "19",
  "number_of_trades": 0,
  "clinched_playoffs": 1,
  "managers": [
    {
      "manager_id": "1",
      "nickname": "--hidden--",
      "guid": "RYWP7M53IC626MGOX36ZWCM4FA",
      "is_commissioner": "1"
    }
  ],
  "matchups": [
    {
      "week": "1",
      "week_start": "2014-03-22",
      "week_end": "2014-04-06",
      "status": "postevent",
      "is_playoffs": "0",
      "is_consolation": "0",
      "is_tied": 0,
      "winner_team_key": "328.l.34014.t.2",
      "teams": [
        {
          "team_key": "328.l.34014.t.1",
          "team_id": "1",
          "name": "ChicksDigTheLongBall",
          "url": "http://baseball.fantasysports.yahoo.com/b1/34014/1",
          "team_logo": "http://l.yimg.com/dh/ap/fantasy/img/mlb/icon_6_lg.gif",
          "waiver_priority": 4,
          "number_of_moves": "19",
          "number_of_trades": 0,
          "clinched_playoffs": 1,
          "managers": [
            {
              "manager_id": "1",
              "nickname": "--hidden--",
              "guid": "RYWP7M53IC626MGOX36ZWCM4FA",
              "is_commissioner": "1"
            }
          ],
          "points": {
            "coverage_type": "week",
            "week": "1",
            "total": "3"
          },
          "stats": [
            {
              "stat_id": "60",
              "value": "71/218"
            },
            {
              "stat_id": "7",
              "value": "32"
            },
            {
              "stat_id": "12",
              "value": "6"
            },
            {
              "stat_id": "13",
              "value": "28"
            },
            {
              "stat_id": "16",
              "value": "6"
            },
            {
              "stat_id": "3",
              "value": ".326"
            },
            {
              "stat_id": "50",
              "value": "47.1"
            },
            {
              "stat_id": "28",
              "value": "2"
            },
            {
              "stat_id": "32",
              "value": "3"
            },
            {
              "stat_id": "42",
              "value": "35"
            },
            {
              "stat_id": "26",
              "value": "2.47"
            },
            {
              "stat_id": "27",
              "value": "0.93"
            }
          ]
        },
        {
          "team_key": "328.l.34014.t.2",
          "team_id": "2",
          "name": "SALEBOAT",
          "url": "http://baseball.fantasysports.yahoo.com/b1/34014/2",
          "team_logo": "https://i.imgur-ysports.com/k9xxNC8y.jpg",
          "waiver_priority": 8,
          "number_of_moves": "30",
          "number_of_trades": "2",
          "clinched_playoffs": 1,
          "managers": [
            {
              "manager_id": "2",
              "nickname": "--hidden--",
              "guid": "APYOZ4FEZELDRTK3F3FEBYTDPY"
            }
          ],
          "points": {
            "coverage_type": "week",
            "week": "1",
            "total": "6"
          },
          "stats": [
            {
              "stat_id": "60",
              "value": "63/230"
            },
            {
              "stat_id": "7",
              "value": "35"
            },
            {
              "stat_id": "12",
              "value": "11"
            },
            {
              "stat_id": "13",
              "value": "34"
            },
            {
              "stat_id": "16",
              "value": "12"
            },
            {
              "stat_id": "3",
              "value": ".274"
            },
            {
              "stat_id": "50",
              "value": "52.0"
            },
            {
              "stat_id": "28",
              "value": "5"
            },
            {
              "stat_id": "32",
              "value": "3"
            },
            {
              "stat_id": "42",
              "value": "55"
            },
            {
              "stat_id": "26",
              "value": "2.94"
            },
            {
              "stat_id": "27",
              "value": "0.96"
            }
          ]
        }
      ]
    }
  ]
}