ESPN updated their web UI and APIs which broke this package. My fantasy league is moving to Sleeper, so I no longer have any intention of updating this package. For more information, see this GitHub issue.
This is a NuGet package for interacting with ESPN's fantasy football API.
The source code was written using C# 7.0. The domain logic targets .NET Standard 2.0, and the unit and integration tests target .NET Core 2.0 and .NET Framework 4.7.1. Note that tests are run against both locally, but Travis CI only tests against .NET Core 2.0.
At the moment, I'm working with a very limited set of fantasy league settings. For reference, my league is 12-person standard, non-PPR. If you run into issues, please be sure to include the JSON repsonse or your league ID and year in the issue description. Feel free to send me your league information so that I can create more deserialization unit tests.
Start by initializing the client:
EspnFantasyFootballClient espnFantasyFootballClient = new EspnFantasyFootballClient();
The client has two methods. The first one fetches league metadata:
League league = await espnFantasyFootballClient.GetLeagueAsync(leagueId, year);
The second fetches the current scoreboard:
LeagueScoreboard leagueScoreboard = await espnFantasyFootballClient.GetScoreboardAsync(leagueId, year);
Note that your leagueId
can be obtained from the URL when navigating to ESPN's fantasy webpage. year
is simply the year in integer format (i.e. 2018).
Please keep in mind that this package is a work in progress. Please feel free to submit issues, improvements, pull requests, etc.