Players on a team are organized into rosters corresponding to certain weeks, in NFL, or certain dates, in MLB, NBA, and NHL. Each player on a roster will be assigned a position if they're in the starting lineup, or will be on the bench. You can only receive credit for stats accumulated by players in your starting lineup.
You can use this API to edit your lineup by PUTting up new positions for the players on a roster. You can also add/drop players from your roster by POSTing new transactions to the league's transactions collection.
GET
PUT
http://fantasysports.yahooapis.com/fantasy/v2/team/{team_key}/roster
Any sub-resource under a roster is extracted using a URI like:
http://fantasysports.yahooapis.com/fantasy/v2/team/{team_key}/roster/{sub_resource}
For NFL, you can specify a week parameter to retrieve a specific week -- otherwise it will default to the current roster
http://fantasysports.yahooapis.com/fantasy/v2/team/{team_key}/roster;week=10
For MLB, NHL, or NBA, you can specify a date parameter to retrieve a specific date -- otherwise it will default to today's roster.
http://fantasysports.yahooapis.com/fantasy/v2/team/{team_key}/roster;date=2011-05-01
Default sub-resource:
players
| Name | Description | URI | Sample |
|---|---|---|---|
players
|
Access the players collection within the roster. |
/fantasy/v2/team/{team_key}/roster/players
|
|
http://fantasysports.yahooapis.com/fantasy/v2/team/253.l.102614.t.10/roster/players
Using PUT, you may modify a subset of players on the roster for a particular day, specifically in terms of changing their position
or whether they're in the starting lineup. The URL for PUTting to a Roster resource is:
http://fantasysports.yahooapis.com/fantasy/v2/team/{team_key}/roster
You may move as many players as you like in your input XML -- any players whose position you do not change will stay in the same position they were previously. If you try to move players in an invalid way, you will receive an error and no changes will be made.
Your input XML should look like:
NFL:
MLB, NBA, or NHL: