CFBSharp - the C# library for the College Football Data API

August 27, 2024 ยท View on GitHub

This is an API for accessing all sorts of college football data. Please note that API keys should be supplied with "Bearer " prepended (e.g. "Bearer your_key"). API keys can be acquired from the CollegeFootballData.com website.

This C# SDK is automatically generated by the Swagger Codegen project:

  • API version: 4.6.0
  • SDK version: 4.6.0
  • Build package: io.swagger.codegen.languages.CSharpClientCodegen

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext
  • UWP >=10.0

Dependencies

  • FubarCoder.RestSharp.Portable.Core >=4.0.7
  • FubarCoder.RestSharp.Portable.HttpClient >=4.0.7
  • Newtonsoft.Json >=10.0.3

Installation

Add the package using the dotnet CLI:

dotnet add package CFBSharp

Then use the relevant namespaces:

using CFBSharp.Api;
using CFBSharp.Client;
using CFBSharp.Model;

Getting Started

using System;
using System.Diagnostics;
using CFBSharp.Api;
using CFBSharp.Client;
using CFBSharp.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {

            // Configure API key authorization: ApiKeyAuth
            Configuration.Default.ApiKey.Add("Authorization", "YOUR_API_KEY");
            Configuration.Default.ApiKeyPrefix.Add("Authorization", "Bearer");

            var apiInstance = new BettingApi();
            var gameId = 56;  // int? | Game id filter (optional) 
            var year = 56;  // int? | Year/season filter for games (optional) 
            var week = 56;  // int? | Week filter (optional) 
            var seasonType = seasonType_example;  // string | Season type filter (regular or postseason) (optional)  (default to regular)
            var team = team_example;  // string | Team (optional) 
            var home = home_example;  // string | Home team filter (optional) 
            var away = away_example;  // string | Away team filter (optional) 
            var conference = conference_example;  // string | Conference abbreviation filter (optional) 

            try
            {
                // Betting lines
                ICollection<GameLines> result = apiInstance.GetLines(gameId, year, week, seasonType, team, home, away, conference);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling BettingApi.GetLines: " + e.Message );
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.collegefootballdata.com

ClassMethodHTTP requestDescription
BettingApiGetLinesGET /linesBetting lines
CoachesApiGetCoachesGET /coachesCoaching records and history
ConferencesApiGetConferencesGET /conferencesConferences
DraftApiGetDraftPicksGET /draft/picksList of NFL Draft picks
DraftApiGetNFLPositionsGET /draft/positionsList of NFL positions
DraftApiGetNFLTeamsGET /draft/teamsList of NFL teams
DrivesApiGetDrivesGET /drivesDrive data and results
GamesApiGetAdvancedBoxScoreGET /game/box/advancedAdvanced box scores
GamesApiGetCalendarGET /calendarSeason calendar
GamesApiGetGameMediaGET /games/mediaGame media information and schedules
GamesApiGetGameWeatherGET /games/weatherGame weather information (Patreon only)
GamesApiGetGamesGET /gamesGames and results
GamesApiGetPlayerGameStatsGET /games/playersPlayer game stats
GamesApiGetScoreboardGET /scoreboardLive game results (Patreon only)
GamesApiGetTeamGameStatsGET /games/teamsTeam game stats
GamesApiGetTeamRecordsGET /recordsTeam records
MetricsApiGetFGEPGET /metrics/fg/epField Goal Expected Points
MetricsApiGetGamePPAGET /ppa/gamesTeam Predicated Points Added (PPA/EPA) by game
MetricsApiGetPlayerGamePPAGET /ppa/players/gamesPlayer Predicated Points Added (PPA/EPA) broken down by game
MetricsApiGetPlayerSeasonPPAGET /ppa/players/seasonPlayer Predicated Points Added (PPA/EPA) broken down by season
MetricsApiGetPredictedPointsGET /ppa/predictedPredicted Points (i.e. Expected Points or EP)
MetricsApiGetPregameWinProbabilitiesGET /metrics/wp/pregamePregame win probability data
MetricsApiGetTeamPPAGET /ppa/teamsPredicted Points Added (PPA/EPA) data by team
MetricsApiGetWinProbabilityDataGET /metrics/wpWin probability chart data
PlayersApiGetPlayerSeasonStatsGET /stats/player/seasonPlayer stats by season
PlayersApiGetPlayerUsageGET /player/usagePlayer usage metrics broken down by season
PlayersApiGetReturningProductionGET /player/returningTeam returning production metrics
PlayersApiGetTransferPortalGET /player/portalTransfer portal by season
PlayersApiPlayerSearchGET /player/searchSearch for player information
PlaysApiGetLivePlaysGET /live/playsLive metrics and PBP (Patreon only)
PlaysApiGetPlayStatTypesGET /play/stat/typesTypes of player play stats
PlaysApiGetPlayStatsGET /play/statsPlay stats by play
PlaysApiGetPlayTypesGET /play/typesPlay types
PlaysApiGetPlaysGET /playsPlay by play data
RankingsApiGetRankingsGET /rankingsHistorical polls and rankings
RatingsApiGetConferenceSPRatingsGET /ratings/sp/conferencesHistorical SP+ ratings by conference
RatingsApiGetEloRatingsGET /ratings/eloHistorical Elo ratings
RatingsApiGetFPIRatingsGET /ratings/fpiHistorical FPI ratings
RatingsApiGetSPRatingsGET /ratings/spHistorical SP+ ratings
RatingsApiGetSRSRatingsGET /ratings/srsHistorical SRS ratings
RecruitingApiGetRecruitingGroupsGET /recruiting/groupsRecruit position group ratings
RecruitingApiGetRecruitingPlayersGET /recruiting/playersPlayer recruiting ratings and rankings
RecruitingApiGetRecruitingTeamsGET /recruiting/teamsTeam recruiting rankings and ratings
StatsApiGetAdvancedTeamGameStatsGET /stats/game/advancedAdvanced team metrics by game
StatsApiGetAdvancedTeamSeasonStatsGET /stats/season/advancedAdvanced team metrics by season
StatsApiGetStatCategoriesGET /stats/categoriesTeam stat categories
StatsApiGetTeamSeasonStatsGET /stats/seasonTeam statistics by season
TeamsApiGetFbsTeamsGET /teams/fbsFBS team list
TeamsApiGetRosterGET /rosterTeam rosters
TeamsApiGetTalentGET /talentTeam talent composite rankings
TeamsApiGetTeamMatchupGET /teams/matchupTeam matchup history
TeamsApiGetTeamsGET /teamsTeam information
VenuesApiGetVenuesGET /venuesArena and venue information

Documentation for Models

Documentation for Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header