0

All players

I am creating a Web site with the fantasy sport API and I have some questions

Exist any way to obtain all the players although they are not in any league?

for example How I can Obtain the ID of a player if this not exist in the league?

I need a XML with all the players of the nfl, nba or any league.


thanks for any help

by
  • ro
  • Dec 13, 2010
10 Replies
  • You can do this using a "game" query instead of a "league" query.

    So instead of:
    .../v2/league/nba.l.xxx/players;out=stats;sort=OR
    you can do:
    .../v2/game/nba/players;out=stats;sort=OR
    0
  • So I've noticed that a /v2/game/nba/players only returns 25 players (I tried setting count= arbitrarily high but it still maxed out at 25)... is there any way to query the entire player database for any sport? I have not spent very much time with the API yet, but it seems to me that there is no way to to access the full database. In particular this seems to make the problem of determining the set of available players pre draft and the set of free agents post draft intractable. If you can't get a player's id, how are you supposed to look up any of their information? Is there at least a listing of all the player ids somewhere that can be hardcoded into an app?

    I appreciate any help. Thanks.
    0
  • To answer my own question: Using the players collection API you can specify a "start" filter. So to get all players you can do something like "players;sort=NAME;start=i" and iterate i by 25 until you have gotten the entire player database in alphabetical order
    0
  • QUOTE (Kyle @ Dec 27 2010, 05:20 PM) <{POST_SNAPBACK}>
    To answer my own question: Using the players collection API you can specify a "start" filter. So to get all players you can do something like "players;sort=NAME;start=i" and iterate i by 25 until you have gotten the entire player database in alphabetical order

    But we'd typically say that you shouldn't do that as we're contractually obligated to not have people pulling down the entire database of player information. :P You're able to do a reasonable amount of sorting and filtering on the list of players that you get back -- is there a particular query I can help you formulate to make it so you don't need to ask for thousands of players to get the data you need?
    0
  • QUOTE (Sean Montgomery @ Jan 21 2011, 12:16 AM) <{POST_SNAPBACK}>
    But we'd typically say that you shouldn't do that as we're contractually obligated to not have people pulling down the entire database of player information. :PThank you for any help
    0
  • QUOTE (ro @ Jan 21 2011, 07:55 AM) <{POST_SNAPBACK}>
    Hi, what happen if I need all the list of players, I found a query where I can return only 25 players, but I have 2 question

    - Can I return more that 25 players?
    - If I cannot return more that 25 players how I can determinate the long of the list of players?


    Thank you for any help

    1) According to the terms of our data licenses, we cannot let you get more than 25 players in that sort of query.
    2) Like I said, I'd like to know what use case you have for needing to pull the entire list of players. As far as our license goes, we'd just have to say, "You can't pull down the entire list of players," but we do have a variety of filtering and sorting options that are designed to try to help you get the players that you need within that top 25. If you tell me what you're trying to do, I can let you know if there are ways we can help you pull out that sort of information, or if it's just an impossible request for us to help out with.
    0
  • Hate to bump old threads, but this has almost exactly what I am looking for. I see you can sort by OR, but how would I, or can I, sort by S? If I can't, is there a way to query where S < 10?

    Thanks
    0
  • QUOTE (xsicxtransitx @ Mar 24 2011, 05:34 PM) <{POST_SNAPBACK}>
    Hate to bump old threads, but this has almost exactly what I am looking for. I see you can sort by OR, but how would I, or can I, sort by S? If I can't, is there a way to query where S < 10?

    Thanks

    By S, do you mean the season rank? I think something like this would work:

    CODE
    http://fantasysports.yahooapis.com/fantasy/v2/league/<league_key>/players;count=25;sort=AR;sort_type=season;sort_season=2010


    AR is...well, one of our rank types, I'm not even sure what it stands for. If you actually look at the players page on the site for one of your leagues, you'll see that when you sort by various columns, we append a "sort" parameter to the URL. Those same sort keys should actually generally work within the webservices, if you pass them as the sort parameter like above. (I also pointed the sort season back to last year because the data is more interesting)
    0
  • QUOTE (Sean Montgomery @ Mar 25 2011, 10:04 PM) <{POST_SNAPBACK}>
    By S, do you mean the season rank? I think something like this would work:

    CODE
    http://fantasysports.yahooapis.com/fantasy/v2/league/<league_key>/players;count=25;sort=AR;sort_type=season;sort_season=2010


    AR is...well, one of our rank types, I'm not even sure what it stands for. If you actually look at the players page on the site for one of your leagues, you'll see that when you sort by various columns, we append a "sort" parameter to the URL. Those same sort keys should actually generally work within the webservices, if you pass them as the sort parameter like above. (I also pointed the sort season back to last year because the data is more interesting)


    Perfect, thanks Sean that is exactly what I needed to know.
    0
  • I ran into this limitation too. The practical reason for needing the whole DB, at least for me... Is when I want to pull the draftresults for my baseball auction league. When you pull down the draft results it only gives you the cost, draft position (which doesn't really apply in an auction) and the PLATER ID. It does not give you the name of the MLB player. Just 268.p.####. How am I supposed to cross reference that ID to the players name? Any ideas?

    Thx! Jim

    0
  • If you have the player keys, you should be able to retrieve the players information by querying the players resource e.g.:

    http://fantasysports.yahooapis.com/fantasy/v2/players;player_keys=304.p.4795

    304.p.4795 4795 Jeremy Lin Jeremy Lin Jeremy Lin nba.p.4795 nba.t.10 Houston Rockets Hou 7 PG http://l.yimg.com/iu/api/res/1.2/ucms9BsymPzDBKx8.0_QIQ--/YXBwaWQ9eXZpZGVvO2NoPTg2MDtjcj0xO2N3PTY1OTtkeD0xO2R5PTE7Zmk9dWxjcm9wO2g9NjA7cT0xMDA7dz00Ng--/http://l.yimg.com/j/assets/i/us/sp/v/nba/players_l/20121217/4795.jpg small http://l.yimg.com/iu/api/res/1.2/ucms9BsymPzDBKx8.0_QIQ--/YXBwaWQ9eXZpZGVvO2NoPTg2MDtjcj0xO2N3PTY1OTtkeD0xO2R5PTE7Zmk9dWxjcm9wO2g9NjA7cT0xMDA7dz00Ng--/http://l.yimg.com/j/assets/i/us/sp/v/nba/players_l/20121217/4795.jpg 0 P PG 1 1

    0

Recent Posts

in Fantasy Sports API