0

Need help building request

I found this great query in another thread and I am using a basis of it for my own league data:

Original:

CODE
http://fantasysports.yahooapis.com/fantasy/v2/games;game_keys=nfl/leagues;league_keys=242.l.121153;out=settings,transactions,messages,scoreboard/teams;team_keys=242.l.121153.t.7;out=standings,stats;stats.type=week;stats.week=
current/roster/players/stats;type=week;week=current


Mine:

CODE
../v2/leagues;use_login=1;league_keys=key;out=settings,transactions,messages,scoreboar
d/teams;league_keys=key;out=standings


This provides me with all the messages,transactions,matchups and team standings in my league, but what I want to do is change it so I can limit the number of messages and transactions I return.

The problem is, I do not know how to properly structure that request, if I change it like the following, I get no matchup data back and the limitation doesn't work anyhow.

CODE
leagues;use_login=1;league_keys=248.l.2161;out=settings,transactions,messages;co
unt=10,scoreboard/teams;league_keys=248.l.2161;out=standings


Any help would be greatly appreciated, thanks

2 Replies
  • QUOTE (xsicxtransitx @ Apr 5 2011, 03:58 PM) <{POST_SNAPBACK}>
    I found this great query in another thread and I am using a basis of it for my own league data:

    Original:

    CODE
    http://fantasysports.yahooapis.com/fantasy/v2/games;game_keys=nfl/leagues;league_keys=242.l.121153;out=settings,transactions,messages,scoreboard/teams;team_keys=242.l.121153.t.7;out=standings,stats;stats.type=week;stats.week=
    current/roster/players/stats;type=week;week=current


    Mine:

    CODE
    ../v2/leagues;use_login=1;league_keys=key;out=settings,transactions,messages,scoreboar
    d/teams;league_keys=key;out=standings


    This provides me with all the messages,transactions,matchups and team standings in my league, but what I want to do is change it so I can limit the number of messages and transactions I return.

    The problem is, I do not know how to properly structure that request, if I change it like the following, I get no matchup data back and the limitation doesn't work anyhow.

    CODE
    leagues;use_login=1;league_keys=248.l.2161;out=settings,transactions,messages;co
    unt=10,scoreboard/teams;league_keys=248.l.2161;out=standings


    Any help would be greatly appreciated, thanks

    Ha, you've just run into one of the primary limitations of our otherwise fairly flexible APIs. You have a lot of freedom to branch subresources, but we didn't come up with a good way to pass parameters into subresources (with the exception of some special casing for stats), meaning we only allow parameters along the primary branch in the URL. So you can make three queries like:

    CODE
    http://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=<key>;out=settings/scoreboard/teams;out=standings
    http://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=<key>/transactions;count=10
    http://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=<key>/messages;count=10


    To get all the data you need, but we don't have any capability to do all of those at once and still limit the number of elements returned within the transactions and messages.

    (also, random note: the reason you weren't getting any matchups back with your last query is that you have a comma instead of a slash in front of "scoreboard". And, for reference, you don't need the "use_login=1" parameter on the leagues collection or the "league_keys=<key>" parameter on the teams collection)
    0
  • QUOTE (Sean Montgomery @ Apr 11 2011, 07:01 PM) <{POST_SNAPBACK}>
    Ha, you've just run into one of the primary limitations of our otherwise fairly flexible APIs. You have a lot of freedom to branch subresources, but we didn't come up with a good way to pass parameters into subresources (with the exception of some special casing for stats), meaning we only allow parameters along the primary branch in the URL. So you can make three queries like:

    CODE
    http://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=<key>;out=settings/scoreboard/teams;out=standings
    http://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=<key>/transactions;count=10
    http://fantasysports.yahooapis.com/fantasy/v2/leagues;league_keys=<key>/messages;count=10


    To get all the data you need, but we don't have any capability to do all of those at once and still limit the number of elements returned within the transactions and messages.

    (also, random note: the reason you weren't getting any matchups back with your last query is that you have a comma instead of a slash in front of "scoreboard". And, for reference, you don't need the "use_login=1" parameter on the leagues collection or the "league_keys=<key>" parameter on the teams collection)



    Awesome, thanks alot, I was hoping to avoid 3 requests, but no big deal
    0

Recent Posts

in Fantasy Sports API