yahoo fantasy api

players.fetch

Retrieve information about multiple players in a single request.

Description
Tester

Arguments

Argument
Description
player_key
The key(s) for the player(s) you'd like to query. League key format: {game_key}.p.{player_id}
Subresource
Description
stats
Retrieve the stats for the retrieved players.
ownership
Retrieve the ownership for the retrieved players.
percent_owned
Retrieve the percent_owned for the retrieved players.
draft_analysis
Retrieve the draft_analysis for the retrieved players.

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 players = await yf.players.fetch(
    [player_keys],
    [subresources], // optional
  );
} catch (e) {
  // handle error
}

// callback based
yf.players.fetch(
  [player_keys], 
  [subresources], // optional
  callbackFn
);

Sample Response

[
  {
    "player_key": "328.p.6619",
    "player_id": "6619",
    "name": {
      "full": "Albert Pujols",
      "first": "Albert",
      "last": "Pujols",
      "ascii_first": "Albert",
      "ascii_last": "Pujols"
    },
    "editorial_player_key": "mlb.p.6619",
    "editorial_team_key": "mlb.t.3",
    "editorial_team_full_name": "Los Angeles Angels",
    "editorial_team_abbr": "LAA",
    "uniform_number": "5",
    "display_position": "1B",
    "headshot": "http://l.yimg.com/iu/api/res/1.2/iium.CfIaaN.XDy7fB4Reg--/YXBwaWQ9eXZpZGVvO…g--/http://l.yimg.com/j/assets/i/us/sp/v/mlb/players_l/20130405/6619.1.jpg",
    "is_undroppable": "0",
    "position_type": "B",
    "eligible_positions": [
      "1B",
      "CI",
      "DH",
      "IF"
    ]
  },
  {
    "player_key": "341.p.3985",
    "player_id": "3985",
    "name": {
      "full": "Joe Pavelski",
      "first": "Joe",
      "last": "Pavelski",
      "ascii_first": "Joe",
      "ascii_last": "Pavelski"
    },
    "editorial_player_key": "nhl.p.3985",
    "editorial_team_key": "nhl.t.18",
    "editorial_team_full_name": "San Jose Sharks",
    "editorial_team_abbr": "SJ",
    "uniform_number": "8",
    "display_position": "C,LW,RW",
    "headshot": "http://l.yimg.com/iu/api/res/1.2/Dd5dNYTipp8s2GCFVkEnuA--/YXBwaWQ9eXZpZGVvO…0Ng--/http://l.yimg.com/j/assets/i/us/sp/v/nhl/players_l/20130211/3985.jpg",
    "is_undroppable": "0",
    "position_type": "P",
    "eligible_positions": [
      "C",
      "LW",
      "RW"
    ]
  }
]