Yahoo! Fantasy Sports API demo using OAuth APIs
This repo will provides starter scripts and links to relevant documentation for interacting with the Yahoo! Fantasy Sports YDN APIs.
The public documentation is somewhat outdated and still tries to link to OAuth1.0 guides, which is no longer supported. You can still use the public documentation to understand basic API structure, but you'll need to use the OAuth2 guide for authorization.
- OAuth2 endpoint:
https://fantasysports.yahooapis.com/fantasy/v2/...
This script demonstrates a very basic OAuth flows in PHP. They do not have any external dependencies, aside from PHP and Curl.
Make sure to have your CONSUMER_KEY and CONSUMER_SECRET handy.
% php oauth_get_teams.php <CONSUMER_KEY> <CONSUMER_SECRET> [game_keys]
CONSUMER_KEY: Your consumer key from your YDN application (set up as described in the OAuth2 Flow)CONSUMER_SECRET: Corresponding consumer secretgame_keys: CSV of game codes or IDs.- Examples:
nfl,nba,mlb,nfl,370
- Examples:
Just run the script with your keys. It'll fetch public NFL players details.
% php oauth_get_public_data.php <CONSUMER_KEY> <CONSUMER_SECRET>
CONSUMER_KEY: Your consumer key from your YDN application (set up as described in the OAuth2 Flow)CONSUMER_SECRET: Corresponding consumer secret