matchup query examples

This is a request for matchup specific REST queries. For example, what's the most efficient way to get data for a given weeks matchup (either current or past years) including how many points each team scored, and the points scored per player (at least, those in the lineup) for that week.

The following is close but not correct:
http://fantasysports.yahooapis.com/fantasy/v2/league/<league id>/scoreboard/matchups/teams/players;week=4

6 Replies
  • Something like this might work a bit better:

    http://fantasysports.yahooapis.com/fantasy/v2/league/<league id>/scoreboard;week=4/matchups/teams/roster;week=4/players/stats;type=week;week=4
  • Thanks, you're fast. :)

    And hopefully the end of this thread, how do we retrieve past matchup/head-to-head (who faced who) information for a given week?
  • QUOTE (Phil @ Nov 12 2010, 12:57 PM) <{POST_SNAPBACK}>
    Thanks, you're fast. :)Hm, interesting question. I'm working on adding in a schedule resource to help get all of that information for all weeks in a single view, but that might take a little bit to get out. As it stands right now, I'd think you'd just want to change all of the week parameters in that query above to match whichever week that you're interested in? It would be one query per week, but it seems like that would get you the information that you're looking for.
  • To possibly close out this topic, let's summarize.

    • A single query can retrieve matchup data for all teams in a league, with updated total team scores, and with or without rosters
    • A single query cannot retrieve individual statistics for multiple team rosters, and is instead limited to a single team

    So for example, if you want to retrieve head-to-head information with individual statistics for each team (and players), you need to perform two queries. Right?

    If so, here are some examples:

    A: Retrieve matchup data (no rosters, for quick lookup, includes total points per team) for a given week:
    http://fantasysports.yahooapis.com/fantasy/v2/league/<league key>/scoreboard;week=<week number>

    B: The above, but including roster information (but not individual stats):
    http://fantasysports.yahooapis.com/fantasy/v2/league/<league key>/scoreboard;week=<week number>/matchups/teams/roster;week=<week number>

    C: Retrieve a single teams data and stats for a given week, which includes roster information:
    http://fantasysports.yahooapis.com/fantasy/v2/team/<team key>/roster;week=<week number>/players/stats;type=week;week=<week number>

    I notice you added "players/stats" to your query so maybe that'll be useful one day in the future (or is now?)? It seems only useful with individual team stats. Anyway, I hope this is useful for people :)
  • And one more. Statistics are stored within the player stats query [C] above, but the statistical category descriptions aren't listed there (only the stat ids are). Here's the query to get those category names, which you should save (only need to query once) or write within a config file :


    Where the stat_id correlates with player_stats->stats->stat->*->stat_id
  • That's an excellent summary, Phil. I keep forgetting exactly how the stats restrictions work, but you're right -- in any context where you're requesting more than one team (even for matchups), it looks like we won't show player stats, meaning you would need to submit separate queries to get the player stat information for each team within a matchup (for the appropriate weekly context), as listed as step C of your post. Very annoying, sorry that we don't have a nicer way around that.

    Worth noting that if you're already getting a league resource, you can also see the stat category information within there by requesting the "settings" subresource beneath the league. Otherwise, yes, holding onto the top level game stat_categories resource probably makes the most sense.

Recent Posts

in Fantasy Sports API