yahoo fantasy api

game.position_types

Retrieve a detailed description of all player position types for a specified game.

Description
Tester

Arguments

Argument
Description
game_key
Key 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)

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 position_types = await yf.game.position_types(game_key);
} catch (e) {
  // handle error
}

// callback based
yf.game.position_types(game_key, callbackFn);

Sample Response

{
  "game_key": "331",
  "game_id": "331",
  "name": "Football",
  "code": "nfl",
  "type": "full",
  "url": "http://football.fantasysports.yahoo.com/f1",
  "season": "2014",
  "position_types": [
    {
      "type": "O",
      "display_name": "Offense"
    },
    {
      "type": "K",
      "display_name": "Kickers"
    },
    {
      "type": "DT",
      "display_name": "Defense/Special Teams"
    },
    {
      "type": "DP",
      "display_name": "Defensive Players"
    }
  ]
}