Use httr::GET()
to make a request to the ESPN API and return the parsed
list from the JSON data. The function uses httr::RETRY()
, so the call will
repeat up to three times if there is a failure.
ffl_api(
leagueId = ffl_id(),
view = NULL,
leagueHistory = FALSE,
seasonId = 2024,
scoringPeriodId = NULL,
...
)
Numeric league ID or ESPN fantasy page URL. Defaults to
getOption("fflr.leagueId")
. Function fails if no ID is found.
Character vector of specific API "views" which describe the data returned (e.g., "mRoster", "mSettings").
logical; Should the leagueHistory
version of the API
be called? If TRUE
, a list of results is returned, with one element for
each historical year of the league.
Integer year of NFL season. By default, the season is
currently set to 2024. Use a recent year or set leagueHistory
to TRUE
to obtain all past data.
Integer week of NFL season. By default, NULL
will
use the current week (see ffl_week()
). Scoring periods are always one
week in length, whereas matchups might be longer.
Additional queries passed to httr::GET()
. Arguments are
converted to a named list and passed to query
alongside view
.
A single JSON string.
if (FALSE) { # \dontrun{
ffl_api()
} # }