### Yahoo Fantasy Sports API Player Data XML Example
Source: https://developer.yahoo.com/fantasysports/index
This XML snippet provides a detailed example of the player data structure returned by the Yahoo Fantasy Sports API. It includes various attributes such as player keys, IDs, full names, editorial team information, uniform numbers, display positions, image URLs, eligibility, and starting status for multiple players.
```XML
https://l.yimg.com/a/i/us/sp/v/mlb/players_l/20110503x/7746.jpg?x=46&y=60&xc=1&yc=1&wc=164&hc=215&q=100&sig=O01i1gfOs6RgisJQjmdipQ--
0
B
1B
2B
OF
Util
1
1
date
2011-07-22
2B
date
2011-07-22
0
253.p.7737
7737
Martin Prado
Martin
Prado
Martin
Prado
mlb.p.7737
mlb.t.15
Atlanta Braves
Atl
14
2B,3B,OF
https://l.yimg.com/a/i/us/sp/v/mlb/players_l/20110503x/7737.jpg?x=46&y=60&xc=1&yc=1&wc=164&hc=215&q=100&sig=WPYI1xO62JwsL8QturlmJw--
0
B
2B
3B
OF
Util
1
date
2011-07-22
3B
date
2011-07-22
1
253.p.7744
7744
Erick Aybar
Erick
Aybar
Erick
Aybar
mlb.p.7744
mlb.t.3
Los Angeles Angels
LAA
2
SS
https://l.yimg.com/a/i/us/sp/v/mlb/players_l/20110503x/7744.jpg?x=46&y=60&xc=1&yc=1&wc=164&hc=215&q=100&sig=qHzsNyGFtGYxlpMxtysSPQ--
0
B
SS
Util
date
2011-07-22
SS
date
2011-07-22
1
253.p.7977
7977
Andrew McCutchen
Andrew
McCutchen
Andrew
McCutchen
mlb.p.7977
mlb.t.23
Pittsburgh Pirates
Pit
22
OF
https://l.yimg.com/a/p/sp/tools/med/2011/05/ipt/1304541420.jpg?x=46&y=60&xc=1&yc=1&wc=164&hc=215&q=100&sig=61GeaeZwqXZWy2ITOX62Zg--
```
--------------------------------
### Yahoo Fantasy Sports Matchup and Team XML Example
Source: https://developer.yahoo.com/fantasysports/guide
This XML snippet provides an example of a Yahoo Fantasy Sports API response for a matchup, showcasing the detailed structure for individual teams. It includes team keys, IDs, names, URLs, logo information, division IDs, FAAB balance, playoff clinching status, manager details (ID, nickname, GUID), and weekly points (actual and projected).
```XML
medium
https://a323.yahoofs.com/coreid/49be42a6i26e5zul3re3/d2x_9_UweKP95SJZ_Hwnk2Rl/2/tn48.jpg?ciA8DVOBIRa6b7wq
2
1
1
12
-- hidden --
RW3ELDFMOFTES2EUAWQVCPPN7E
week
16
135.22
week
16
142.81
223.l.431.t.10
10
Gehlken
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/10
medium
https://a323.yahoofs.com/coreid/4b978f0ci2432zws140sp2/imXqmYo8cq3NxEFtQB4wgAs-/6/tn48.jpeg?ciA8DVOBMH.UXGXk
1
0
1
5
-- hidden --
4LAITFUXFASDNAXFWUOHWNU3BY
week
16
137.86
week
16
133.57
16
postevent
0
223.l.431.t.8
223.l.431.t.8
8
Y! - Pianowski
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/8
medium
https://l.yimg.com/a/i/us/sp/fn/default/full/nfl/icon_10_48.gif
1
0
1
6
-- hidden --
WMKEJTV3VUJA4VZWQ25O27W43M
week
16
103.39
week
16
104.17
223.l.431.t.12
12
Y! - Behrens
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/12
medium
https://lookup.avatars.yahoo.com/images?yid=abehrens53&size=medium&type=jpg&pty=3000
1
0
1
3
-- hidden --
E2KS77CDQPACRTSBCYPOFFW6AI
week
16
101.94
```
--------------------------------
### Example XML Response for Player Statistics and Points
Source: https://developer.yahoo.com/fantasysports/index
An example XML structure showing player statistics and total points for a season within the Yahoo Fantasy Sports API context. This snippet illustrates the format for individual player data, including stat IDs, values, coverage type, season, and total points.
```XML
6
11
9
33
10
2
11
1
12
-4
13
0
15
0
16
0
18
6
57
0
season
2009
310.17
```
--------------------------------
### Example of Chaining Sub-Resources in Yahoo Fantasy API
Source: https://developer.yahoo.com/fantasysports/guide
Demonstrates how to construct a URI to chain multiple resources and collections, such as a logged-in user, their games, and leagues within those games, using the Yahoo Fantasy Sports API.
```APIDOC
/fantasy/v2/;use_login=1//
```
--------------------------------
### PHP Yahoo OAuth 1.0a Authentication and API Access Example
Source: https://developer.yahoo.com/fantasysports/guide
This comprehensive PHP example demonstrates the full OAuth 1.0a authentication flow for Yahoo APIs. It covers obtaining a request token, user authorization via a URL, capturing the verifier, exchanging for an access token, and then using that access token to make a sample API call. The script also includes logic to persist the access token data to a file for subsequent use, avoiding repeated authorization steps. Error handling for OAuth exceptions and API request failures is integrated.
```php
// 3. If none of that worked, send the user to get a new token
if( ! $access_token ) {
print "Better try to get a new access token.\n";
$o = new OAuth( $consumer_key, $consumer_secret,
OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI );
$o->enableDebug();
$request_token = NULL;
try {
$response = $o->getRequestToken( "https://api.login.yahoo.com/oauth/v2/get_request_token", 'oob' );
$request_token = $response['oauth_token'];
$request_secret = $response['oauth_token_secret'];
print "Hey! Go to this URL and tell us the verifier you get at the end.\n";
print ' ' . $response['xoauth_request_auth_url'] . "\n";
} catch( OAuthException $e ) {
print $e->getMessage() . "\n";
}
// Wait for input, then try to use it to get a new access token.
if( $request_token && $request_secret ) {
print "Type the verifier and hit enter...\n";
$verifier = fgets( STDIN );
$verifier = rtrim( $verifier );
print "Here's the verifier you gave us: ${verifier}\n";
try {
$o->setToken( $request_token, $request_secret );
$response = $o->getAccessToken( 'https://api.login.yahoo.com/oauth/v2/get_token', NULL, $verifier );
print "Got it!\n";
$access_token = $response['oauth_token'];
$access_secret = $response['oauth_token_secret'];
$access_session = $response['oauth_session_handle'];
$store_access_token_data = true;
print " Token: ${access_token}\n";
print " Secret: ${access_secret}\n";
print " Session Handle: ${access_session}\n\n";
} catch( OAuthException $e ) {
print 'Error: ' . $e->getMessage() . "\n";
print 'Response: ' . $e->lastResponse . "\n";
print "Shoot, couldn't get the access token. :(\n";
}
}
}
if( $access_token ) {
// Try to make request using stored token
try {
$o->setToken( $access_token, $access_secret );
if( $o->fetch( $url ) ) {
print "Got data from API:\n\n";
print $o->getLastResponse() . "\n\n";
print "Successful!\n";
} else {
print "Couldn't fetch\n";
}
} catch( OAuthException $e ) {
print 'Error: ' . $e->getMessage() . "\n";
print 'Error Code: ' . $e->getCode() . "\n";
print 'Response: ' . $e->lastResponse . "\n";
}
}
// 4. Rewrite token information if necessary
if( $store_access_token_data ) {
print "Looks like we need to store access token data! Doing that now.\n";
$tok_fh = fopen( $token_file_name, 'w' );
if( $tok_fh ) {
fwrite( $tok_fh, "${access_token}\n" );
fwrite( $tok_fh, "${access_secret}\n" );
fwrite( $tok_fh, "${access_session}\n" );
fclose( $tok_fh );
} else {
print "Hm, couldn't open file to write back access token information.\n";
}
}
?>
```
--------------------------------
### Example Player Roster Data XML
Source: https://developer.yahoo.com/fantasysports/guide
An example XML structure representing player data within a fantasy team's roster, including player details, positions, and status. This illustrates the typical response format for retrieving roster information.
```XML
date
2011-07-22
BN
253.p.6571
6571
Ryan Vogelsong
Ryan
Vogelsong
Ryan
Vogelsong
mlb.p.6571
mlb.t.26
San Francisco Giants
SF
32
SP,RP
https://l.yimg.com/a/i/us/sp/v/mlb/players_l/20110706/6571.jpg?x=46&y=60&xc=1&yc=1&wc=164&hc=215&q=100&sig=bdeeFeFntdasbz_0xzXCGA--
0
P
SP
RP
P
1
date
2011-07-22
BN
253.p.7382
7382
David Wright
David
Wright
David
Wright
DL
1
mlb.p.7382
mlb.t.21
New York Mets
NYM
5
3B
https://l.yimg.com/a/i/us/sp/v/mlb/players_l/20110503x/7382.jpg?x=46&y=60&xc=1&yc=1&wc=164&hc=215&q=100&sig=QNOFMSgR6NuPxUwDMUSM1w--
0
B
3B
Util
DL
1
1
date
2011-07-22
DL
date
2011-07-22
1
```
--------------------------------
### Example XML Response for Team Stats
Source: https://developer.yahoo.com/fantasysports/guide
An example XML structure showing statistical data for a team in Yahoo Fantasy Sports, including various stat IDs and their corresponding values for a specific date.
```XML
2011-07-06
60
13/31
7
9
12
3
13
11
16
1
3
.419
50
7.0
28
1
32
0
42
6
26
1.29
27
0.71
```
--------------------------------
### Users Collection URI Examples
Source: https://developer.yahoo.com/fantasysports/guide
Illustrates various URI formats for extracting single or multiple sub-resources from the Users collection, including login and field-specific queries, demonstrating how to construct API requests.
```APIDOC
/users;use_login=1/{sub_resource}
/users;use_login=1;out={sub_resource_1},{sub_resource_2}
/users;field={field_name1},{field_name2}
```
--------------------------------
### Example XML for Yahoo Fantasy Sports Team Data
Source: https://developer.yahoo.com/fantasysports/guide
This XML snippet provides a detailed structure for multiple fantasy sports teams, including their unique key, ID, name, associated URLs, team logos, division ID, FAAB balance, manager details (ID, nickname, GUID, commissioner status), season points, and comprehensive standings (rank, wins, losses, ties, percentage, divisional outcomes). Note that the first team's opening tag was inferred to complete the snippet.
```XML
Erickson - RotoWire
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/13
medium
https://lookup.avatars.yahoo.com/images?yid=jeff_rotonews&size=medium&type=jpg&pty=3000
2
17
11
-- hidden --
SB4Y5HVVUKMCTKZFQCXHIZ222E
season
2009
1484.56
9
6
7
0
.462
3
3
0
223.l.431.t.9
9
Y! - Funston
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/9
medium
https://lookup.avatars.yahoo.com/images?yid=brandoanf1&size=medium&type=jpg&pty=3000
1
10
1
-- hidden --
3H7IQ3F2742K2ODHSJK5YXL23E
1
season
2009
1430.24
10
6
7
0
.462
2
4
0
223.l.431.t.7
7
RotoWire_Liss
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/7
medium
https://l.yimg.com/a/i/us/sp/fn/default/full/nfl/icon_10_48.gif
2
68
7
-- hidden --
4BDB5LIG3IFVROH7SRBX44LBZM
season
2009
1424.56
11
6
7
0
.462
3
3
0
```
--------------------------------
### Example XML Response for Yahoo Fantasy Sports Scoreboard
Source: https://developer.yahoo.com/fantasysports/index
This XML snippet provides an example response from the Yahoo Fantasy Sports API's scoreboard endpoint. It details league information such as key, ID, name, URL, draft status, number of teams, and scoring type. Crucially, it includes scoreboard data with the current week and individual matchup details, including team keys, IDs, names, and URLs for participating teams.
```XML
223.l.431
431
Y! Friends and Family League
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431
postdraft
14
17
1262595518
head
16
1
16
1
16
16
postevent
0
223.l.431.t.10
223.l.431.t.5
5
RotoExperts
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/5
```
--------------------------------
### Example XML Response for Team Projected Points
Source: https://developer.yahoo.com/fantasysports/index
An example XML structure showing projected points for a team within a fantasy league, including coverage type, week, and total points. This snippet is part of a larger fantasy content structure.
```XML
week
16
127.28
```
--------------------------------
### Yahoo Fantasy Sports API: League Key Format
Source: https://developer.yahoo.com/fantasysports/index
Explains the specific format for league keys used in the API, providing examples and a crucial note about the separator character.
```APIDOC
.l.{league_id}
Example: pnfl.l.431 or 223.l.431
Note: The separator between the game_key and league_id is a lower case L (not the number 1).
```
--------------------------------
### Example XML Response for Player Statistics
Source: https://developer.yahoo.com/fantasysports/guide
Illustrates the structure of player statistics and points data returned by the Yahoo Fantasy Sports API. This includes individual stat IDs and their corresponding values, as well as total season points for a player.
```xml
6
11
9
33
10
2
11
1
12
-4
13
0
15
0
16
0
18
6
57
0
season
2009
310.17
```
--------------------------------
### Constructing a Chained Sub-Resource Request URI
Source: https://developer.yahoo.com/fantasysports/index
This example URI demonstrates how to chain multiple sub-resources (Users, Games, Leagues) for a logged-in user within the Yahoo Fantasy Sports API. It illustrates the hierarchical retrieval of user-specific game and league information by specifying the resource path.
```APIDOC
/fantasy/v2/;use_login=1//
```
--------------------------------
### Yahoo Fantasy Sports Team XML Structure Example
Source: https://developer.yahoo.com/fantasysports/guide
An example of the XML structure for a single fantasy sports team, detailing its various attributes and nested elements like team logos, managers, points, and standings. This structure is typically returned by the Yahoo Fantasy Sports API when querying team-specific information.
```XML
223.l.431.t.8
8
Y! - Pianowski
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/8
medium
https://l.yimg.com/a/i/us/sp/fn/default/full/nfl/icon_10_48.gif
1
0
1
6
-- hidden --
WMKEJTV3VUJA4VZWQ25O27W43M
season
2009
1569.48
3
8
5
0
.615
4
2
0
```
--------------------------------
### Example XML Response for Fantasy Sports Matchup
Source: https://developer.yahoo.com/fantasysports/index
This XML snippet illustrates the detailed structure of a Yahoo Fantasy Sports API response for a team matchup, including information about participating teams, their managers, team logos, and weekly points.
```xml
0
223.l.431.t.1
223.l.431.t.1
1
PFW - Blunda
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/1
medium
https://l.yimg.com/a/i/us/sp/fn/default/full/nfl/icon_01_48.gif
2
22
13
Michael Blunda
XNAXQZRDZPJ3RVFMY7ZTSWEFLU
week
5
140.00
week
5
110.85
223.l.431.t.7
7
RotoWire_Liss
https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/7
medium
https://l.yimg.com/a/i/us/sp/fn/default/full/nfl/icon_10_48.gif
2
68
7
RotoWire_Liss
4BDB5LIG3IFVROH7SRBX44LBZM
week
5
86.47
week
5
88.14
```
--------------------------------
### Example Transaction Data Structure (GET Response)
Source: https://developer.yahoo.com/fantasysports/guide
This XML snippet illustrates the structure of a transaction object, typically returned by a GET request to the transactions collection. It shows details for two players involved in a pending trade, including their names and transaction data.
```XML
257.p.6789
6789
Adrian Peterson
Adrian
Peterson
Adrian
Peterson
pending_trade
team
257.l.193.t.2
team
257.l.193.t.1
257.p.9527
9527
Arian Foster
Arian
Foster
Arian
Foster
pending_trade
team
257.l.193.t.1
team
257.l.193.t.2
```