The Yahoo Fantasy Baseball API

Today, I’m going to take a look at Yahoo’s Fantasy Sports API. If any of the details are unclear, just leave a comment and we’ll clear ’em up.

The Fantasy Sports API, announced on June 2, 2010, appears to be the only published and freely available API of its kind on the web. Currently baseball and football are included in the API, with basketball and hockey coming later in the year. From here we’ll take it FAQ-style.

What is an API?
In a general sense, an API (Application Programming Interface) is a piece of software that exposes functionality for other software to leverage or integrate. More specific to the web realm, APIs allow sites and applications to retrieve and post data from external services. APIs are the glue that holds Web 2.0 together: mashup sites that incorporate a live Twitter feed or Google Map, buttons that let you “like” a blog post on Facebook, and similar things are all taking advantage of APIs.

So what does the Yahoo Fantasy Sports API do then?
In a nutshell, this API fulfills requests for information with structured data responses. So, if your app wants to know what Barry Zito did in a specific game, or the draft results of a fantasy team, it makes a call out to Yahoo’s API, and gets the requested data back in either an xml or json response. The data in either response format is the same and structured the same way, but have different uses. Xml is a markup language and superset of html, while json is an object notation designed for use with Javascript, but that can be decoded by any popular programming language. The Fantasy Sports API is primarily a read-only tool at this point, but there is an API call post transactions to a team as well.

What data is available?
I’ll admit I haven’t fully sunk my teeth into this yet, but from reading the documentation, it’s mostly metadata associated with running fantasy leagues: draft results, team rosters, ownership status, etc. Individual player stats are available, but which ones specifically isn’t included in the documentation.

Can I set it in action?
Given that the API was only released less than a month ago, there don’t seem to be many live examples yet. The only one I’ve found of a site or app using the Yahoo Fantasy Baseball API is the Pickemfirst app, which I haven’t tried since I am not participating in any fantasy leagues this year. On top of that, usage of this API is limited to non-commercial tools and applications, which may act as a deterrent to potential developers. The hobbyist community is capable of producing great things, though, so it’ll be interesting to see what emerges from the release of this API.

You Aren't a FanGraphs Member
It looks like you aren't yet a FanGraphs Member (or aren't logged in). We aren't mad, just disappointed.
We get it. You want to read this article. But before we let you get back to it, we'd like to point out a few of the good reasons why you should become a Member.
1. Ad Free viewing! We won't bug you with this ad, or any other.
2. Unlimited articles! Non-Members only get to read 10 free articles a month. Members never get cut off.
3. Dark mode and Classic mode!
4. Custom player page dashboards! Choose the player cards you want, in the order you want them.
5. One-click data exports! Export our projections and leaderboards for your personal projects.
6. Remove the photos on the home page! (Honestly, this doesn't sound so great to us, but some people wanted it, and we like to give our Members what they want.)
7. Even more Steamer projections! We have handedness, percentile, and context neutral projections available for Members only.
8. Get FanGraphs Walk-Off, a customized year end review! Find out exactly how you used FanGraphs this year, and how that compares to other Members. Don't be a victim of FOMO.
9. A weekly mailbag column, exclusively for Members.
10. Help support FanGraphs and our entire staff! Our Members provide us with critical resources to improve the site and deliver new features!
We hope you'll consider a Membership today, for yourself or as a gift! And we realize this has been an awfully long sales pitch, so we've also removed all the other ads in this article. We didn't want to overdo it.




Patrick Newman is a veteran enthusiast of Japanese baseball who happens to write about it at npbtracker.com, and on Twitter @npbtracker.

27 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Dan in Japan
16 years ago

Fascinating, thanks for bringing this to my attention.

Hopefully if there are other live examples out there, commenters will link them…

Tom B
16 years ago

The pickemfirst app looks very cool, but I can’t get it to log into Yahoo without erroring out:/

jinaz
16 years ago
Reply to  Tom B

I haven’t gotten past the issue with pickemfirst that I have to give it my yahoo username & password. Not quite ready for that, especially when I don’t know anything about the company or its motives…
-j

Pickemfirst
16 years ago
Reply to  jinaz

The great thing about the Yahoo API is that you no longer need to share your Yahoo username and password with us.
All you need to do is allow us to access your fantasy profile (in the same way you allow application to access your facebook profile)
This is the beauty of OAuth.

Some users are reporting issues with OAuth, but it works in most cases.
Please give it a try…

Adam
16 years ago
Reply to  jinaz

So make a dumi-API email account 😉

Peter
16 years ago
Reply to  Tom B

I get the same issue, I try to authorize it to do whatever to my yahoo account and I just get a blank white page saying oauth error.

Pickemfirst
16 years ago
Reply to  Peter

yes, there is a bug on our side affecting a small percentage of Yahoo users.
We’re working on a fix.

Zach V
16 years ago

I haven’t had a chance to look into this yet, but it has me excited. Anyone know if it lets you query by actual MLB game? I.e. could I query to get the player performances of yesterdays Twins-Tigers game?

Chris B.
16 years ago

Pickemfirst seems like a great idea, but has been an absolute train wreck for me. It’s going to take a while to pick up the pieces of my shattered Firefox browser, and I never did get the Pickem tools to work with my leagues.

Carson CistulliMember
16 years ago

This post reminds me of those couple-few times I’ve watched matches on the outer courts at the US Open. No matter how good I’ve gotten at tennis or the level of competition I’ve faced, I’m always shocked by how hard the professionals hit and the pace at which the game is played.

Likewise, if ever I’m feeling like I’ve reached my full potential as a nerd, I can merely return to this post for a complete and thorough humbling.

Rays Fan
16 years ago

I got Pickemfirst running with my Yahoo league, and it’s pretty cool. It took a few tries… I’m having fun lookin through the leaderboard pages on Fangraphs, I can sort by wOBA and see which leaders are taken in my league.

One error that stood out immediately is that Ryan Braun had a green square next to his name (indicating he was available in my league) when he definitely is not available (I checked really quick when I saw that & know the owner, not letting him go).

Rays Fan
16 years ago
Reply to  Rays Fan

Same deal for Chris Young the OF with Arizona. I get a green box next to him indicating he is available when he is taken. But Chris Young the SP is available, so I’m wondering if there is a glitch there for players with the same name.

Not sure why Ryan Braun is shown as available though, he’s been taken the whole year. When I use Pickemfirst to parse the team page that Ryan Braun is on it still shows up with a green square. Oh well. For the most part it’s a pretty cool app…

Pickemfirst
16 years ago
Reply to  Rays Fan

The reason is simple: There are 2 players called Ryan Braun and 2 players called Chris Young.
If you click on the green icon Pickemfirst will open a disambiguation window, and you will see right away whicj one is available and which one is taken…

a future version of Pickemfirst will be smarter and try to guess the player based on the page context…

FantasySP
16 years ago

FantasySP is another website that utilizes the Yahoo API. Though few people have heard of it. Incredibly easy to use,and even has a mobile website. Best of all, new signups get all advertisements removed.

FantasySP collects fantasy player news from dozens of top sources (rotoworld, fanball, fangraph, cbssports, rotowire, etc etc). This way when you Sync your fantasy league, they give you all the player news you could possibly want about your team’s players.

Why waste time browsing the web for injury news when FantasySP already collected it for you?

JoeS
16 years ago

Hey guys I’m running Chrome and I had the OAuth error too. I simply closed out and restarted the browser and it worked.

One thing, I wish I didn’t have to click P1 on every site that I go on, I wish it would just automatically be on and I could click just to turn it off. Oh well, still a great tool. Thanks

Pickemfirst
16 years ago
Reply to  JoeS

Thanks for posting this, JoeS.
I’m still struggling to understand these OAuth errors.
it’s good to know that they sometimes disappear by themselves 😉

I thought about having Pickemfirst automatically on.
I just need to write some code that recognizes which sports a particular web page refers to.
Then I need to handle the (rare) case where a page refers to more than one sport.
Nothing impossible, so this will probably come in the next version.

Jon G
16 years ago

Pick’em First is pretty good. Just installed it a few days ago. I haven’t gotten it to work with Yahoo, but it works with my CBS league no prob. I definitely use it with this site all the time.

Pickemfirst
16 years ago
Reply to  Jon G

yes, Pickemfirst will also let you import leagues from ESPN, CBS, MyFantasyLeague, Rotowire…
We provide a single access point to all your leagues, which is even more convenient if you play fantasy on multiple websites.

to go back to the subject of this post, sites like ESPN and CBS do not provides APIs so if you play on one of their private leagues, then Pickemfirst needs to ask for your password…

eastsider
16 years ago

This discussion seems to have turned into one about pickemfirst. I looked at their site, looks ok. You can get news about players, their availability in your leagues, and something about their recent performance. At least that is all that looks interesting to me…

I’d like to turn the discussion over to the question of “what would you like to be able to learn with data from your league and does the yahoo API provide this.”

I would like to see more trend information. The yahoo graph on the standings page is nice – I can see that I am in third in steals and closer to the fourth place team than second. But, am I pulling away from fourth and closer to second place? Am I starting to fall back? Maybe I should pick up a speedster, maybe I don’t need to. A nice trend graph for each stat would be nice. I made a scraper in perl to grab each day’s standings for each stat. Now I am working on making a script that would chart these using GD. The yahoo API is not going to help with the graphing, but depending on the data in the standings, it would make scraping unnecessary.

What would help you?

Pickemfirst
16 years ago
Reply to  eastsider

Hi eastsider,

if you want to discuss what is possible with the Yahoo Fantasy Sports API you should post to this forum: http://developer.yahoo.net/forum/?showforum=122&cookiecheckonly=1
You will get answers from the Yahoo developers directly

I might be wrong but I don’t think the API give you access to the standings history, which would make it difficult to create trends (unless you connect each day)

Pickemfirst
16 years ago

I’m happy to report that all the Yahoo Oauth errors are now fixed in Pickemfirst.

Thanks to FanGraphs users for reporting them!

Friend
14 years ago

Hi,
I have done all of the URL integarations in my iphone app but not abke to get the URL of batting statistics of the teams that are currently playing.

Thank u

Blake Janelle
13 years ago

Hi Guys,

As a hobbyist, I created a few tools at http://www.rotocalculator.com

Among them I have a Rotisserie Calculator for head-to-head leagues, and a week-by-week category tracker which allows you to see your stats over time and compare them to other teams and the league average. Check it out if you are interested.