Retrieve teams that the user belongs to in one or more games. The teams will be scoped to the user. This will throw an error if any of the specified games do not support league sub-resources. Users must be authenticated in order to use this endpoint.
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.user.game_teams(game_key);
} catch (e) {
// handle error
}
// callback based
yf.user.game_teams(game_key, callbackFn);
{
"guid": "RYWP7M53IC626MGOX36ZWCM4FA",
"teams": [
{
"game_key": "328",
"game_id": "328",
"name": "Baseball",
"code": "mlb",
"type": "full",
"url": "http://baseball.fantasysports.yahoo.com/b1",
"season": "2014",
"teams": [
{
"team_key": "328.l.24281.t.7",
"team_id": "7",
"name": "ChicksDigTheLongBall",
"is_owned_by_current_login": 1,
"url": "http://baseball.fantasysports.yahoo.com/b1/24281/7",
"team_logo": "https://i.imgur-ysports.com/PhEXA9Ry.jpg",
"waiver_priority": 6,
"number_of_moves": "18",
"number_of_trades": 0,
"managers": [
{
"manager_id": "7",
"nickname": "dewberry",
"guid": "RYWP7M53IC626MGOX36ZWCM4FA",
"is_current_login": "1",
"email": "dewey@whatadewitt.com",
"image_url": "https://socialprofiles.zenfs.com/images/8ed931b36884df369fae061f758e1c43_64.jpg"
}
]
},
{
"team_key": "328.l.34014.t.1",
"team_id": "1",
"name": "ChicksDigTheLongBall",
"is_owned_by_current_login": 1,
"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": "dewberry",
"guid": "RYWP7M53IC626MGOX36ZWCM4FA",
"is_commissioner": "1",
"is_current_login": "1",
"email": "dewey@whatadewitt.com",
"image_url": "https://socialprofiles.zenfs.com/images/8ed931b36884df369fae061f758e1c43_64.jpg"
}
]
}
]
},
{
"game_key": "341",
"game_id": "341",
"name": "Hockey",
"code": "nhl",
"type": "full",
"url": "http://hockey.fantasysports.yahoo.com/hockey",
"season": "2014",
"teams": [
{
"team_key": "341.l.21063.t.1",
"team_id": "1",
"name": "Neal in the Staal",
"is_owned_by_current_login": 1,
"url": "http://hockey.fantasysports.yahoo.com/hockey/21063/1",
"team_logo": "https://i.imgur-ysports.com/PhEXA9Ry.jpg",
"waiver_priority": 9,
"number_of_moves": "4",
"number_of_trades": 0,
"managers": [
{
"manager_id": "1",
"nickname": "dewberry",
"guid": "RYWP7M53IC626MGOX36ZWCM4FA",
"is_commissioner": "1",
"is_current_login": "1",
"email": "dewey@whatadewitt.com",
"image_url": "https://socialprofiles.zenfs.com/images/8ed931b36884df369fae061f758e1c43_64.jpg"
}
]
}
]
}
]
}