| Title: | Access Data from the 'Impect' API |
|---|---|
| Description: | Pull data from the 'Impect' Customer API <https://glossary.impect.com/api-design>. The package can retrieve data such as events or match sums. |
| Authors: | Impect GmbH [cph], Florian Schmitt [aut, cre], Thomas Walentin [ctb] |
| Maintainer: | Florian Schmitt <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 2.5.5 |
| Built: | 2026-05-14 08:59:34 UTC |
| Source: | https://github.com/cran/impectR |
Get an access token from the 'Impect' Customer API
getAccessToken( username, password, token_url = "https://login.impect.com/auth/realms/production/protocol/openid-connect/token" )getAccessToken( username, password, token_url = "https://login.impect.com/auth/realms/production/protocol/openid-connect/token" )
username |
your 'IMPECT' username |
password |
your 'IMPECT' password |
token_url |
host specific token url |
a string containing a bearer token
# Toy example: this will error quickly (no credentials) try(getAccessToken(username = "invalidUser", password = "invalidPassword")) # Real usage: requires valid credentials ## Not run: token <- getAccessToken(username = "yourUsername", password = "yourPassword") ## End(Not run)# Toy example: this will error quickly (no credentials) try(getAccessToken(username = "invalidUser", password = "invalidPassword")) # Real usage: requires valid credentials ## Not run: token <- getAccessToken(username = "yourUsername", password = "yourPassword") ## End(Not run)
Return a dataframe that contains all events and kpi values for a set of given match IDs
getEvents( matches, token, include_kpis = TRUE, include_set_pieces = FALSE, host = "https://api.impect.com" )getEvents( matches, token, include_kpis = TRUE, include_set_pieces = FALSE, host = "https://api.impect.com" )
matches |
'IMPECT' match ID or a list of match IDs |
token |
bearer token |
include_kpis |
include KPIs in event data |
include_set_pieces |
include additional set piece data in event data |
host |
host environment |
a dataframe containing all events and kpi values for a set of given match IDs
# Toy example: this will error quickly (no API token) try(events <- getEvents( matches = c(0, 1), token = "invalid", include_kpis = T, include_set_pieces = F )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: events <- getEvents( matches = c(84248, 158150), token = "yourToken", include_kpis = T, include_set_pieces = F ) ## End(Not run)# Toy example: this will error quickly (no API token) try(events <- getEvents( matches = c(0, 1), token = "invalid", include_kpis = T, include_set_pieces = F )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: events <- getEvents( matches = c(84248, 158150), token = "yourToken", include_kpis = T, include_set_pieces = F ) ## End(Not run)
Return a dataframe that contains all starting formations for a set of given match IDs
getFormations(matches, token, host = "https://api.impect.com")getFormations(matches, token, host = "https://api.impect.com")
matches |
'IMPECT' match ID or a list of match IDs |
token |
bearer token |
host |
host environment |
a dataframe containing all starting formations for a set of given match IDs
# Toy example: this will error quickly (no API token) try(events <- getFormations( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: formations <- getFormations( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(events <- getFormations( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: formations <- getFormations( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)
Return a dataframe containing all iterations available to the user
getIterations(token, host = "https://api.impect.com")getIterations(token, host = "https://api.impect.com")
token |
bearer token |
host |
host environment |
a dataframe containing all iterations available to the user
# Toy example: this will error quickly (no API token) try(events <- getIterations( token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: iterations <- getIterations( token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(events <- getIterations( token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: iterations <- getIterations( token = "yourToken" ) ## End(Not run)
Return a dataframe with basic information for all matches for a given iteration ID
getMatches(iteration, token, host = "https://api.impect.com")getMatches(iteration, token, host = "https://api.impect.com")
iteration |
'IMPECT' iteration ID |
token |
bearer token |
host |
host environment |
a dataframe containing all matches for a given iteration ID
# Toy example: this will error quickly (no API token) try(matchplan <- getMatches( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: matchplan <- getMatches( iteration = 1004, token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(matchplan <- getMatches( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: matchplan <- getMatches( iteration = 1004, token = "yourToken" ) ## End(Not run)
Return a dataframe that contains all player averages for a given iteration ID
getPlayerIterationAverages(iteration, token, host = "https://api.impect.com")getPlayerIterationAverages(iteration, token, host = "https://api.impect.com")
iteration |
'IMPECT' iteration ID |
token |
bearer token |
host |
host environment |
a dataframe containing the KPI averages aggregated per player and position for the given iteration ID
# Toy example: this will error quickly (no API token) try(player_avgs <- getPlayerIterationAverages( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: player_avgs <- getPlayerIterationAverages( iteration = 1004, token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(player_avgs <- getPlayerIterationAverages( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: player_avgs <- getPlayerIterationAverages( iteration = 1004, token = "yourToken" ) ## End(Not run)
Return a dataframe that contains all player scores for a given iteration ID
getPlayerIterationScores( iteration, token, positions = NULL, host = "https://api.impect.com" )getPlayerIterationScores( iteration, token, positions = NULL, host = "https://api.impect.com" )
iteration |
'IMPECT' iteration ID |
token |
bearer token |
positions |
optional list of position names. Must be one of: "GOALKEEPER", "LEFT_WINGBACK_DEFENDER", "RIGHT_WINGBACK_DEFENDER", "CENTRAL_DEFENDER", "DEFENSE_MIDFIELD", "CENTRAL_MIDFIELD", "ATTACKING_MIDFIELD", "LEFT_WINGER", "RIGHT_WINGER", "CENTER_FORWARD". If not submitted, function will return all positions individually. |
host |
host environment |
a dataframe containing the player scores aggregated per player for the given iteration ID and list of positions
# Toy example: this will error quickly (no API token) try(player_scores <- getPlayerIterationScores( iteration = 0, positions = c("INVALID_POSITION_1", "INVALID_POSITION_2"), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: player_scores <- getPlayerIterationScores( iteration = 1004, positions = c("CENTRAL_DEFENDER", "DEFENSE_MIDFIELD"), token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(player_scores <- getPlayerIterationScores( iteration = 0, positions = c("INVALID_POSITION_1", "INVALID_POSITION_2"), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: player_scores <- getPlayerIterationScores( iteration = 1004, positions = c("CENTRAL_DEFENDER", "DEFENSE_MIDFIELD"), token = "yourToken" ) ## End(Not run)
Return a dataframe that contains all player scores for a given match ID and list of positions
getPlayerMatchScores( matches, token, positions = NULL, host = "https://api.impect.com" )getPlayerMatchScores( matches, token, positions = NULL, host = "https://api.impect.com" )
matches |
'IMPECT' match IDs |
token |
bearer token |
positions |
optional list of position names. Must be one of: "GOALKEEPER", "LEFT_WINGBACK_DEFENDER", "RIGHT_WINGBACK_DEFENDER", "CENTRAL_DEFENDER", "DEFENSE_MIDFIELD", "CENTRAL_MIDFIELD", "ATTACKING_MIDFIELD", "LEFT_WINGER", "RIGHT_WINGER", "CENTER_FORWARD". If not submitted, function will return all positions individually. |
host |
host environment |
a dataframe containing the scores aggregated per player and position for the given match ID and list of positions
# Toy example: this will error quickly (no API token) try(player_match_scores <- getPlayerMatchScores( matches = c(0, 1), positions = c("INVALID_POSITION_1", "INVALID_POSITION_2"), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: player_match_scores <- getPlayerMatchScores( matches = c(84248, 158150), positions = c("CENTRAL_DEFENDER", "DEFENSE_MIDFIELD"), token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(player_match_scores <- getPlayerMatchScores( matches = c(0, 1), positions = c("INVALID_POSITION_1", "INVALID_POSITION_2"), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: player_match_scores <- getPlayerMatchScores( matches = c(84248, 158150), positions = c("CENTRAL_DEFENDER", "DEFENSE_MIDFIELD"), token = "yourToken" ) ## End(Not run)
Return a dataframe that contains all player matchsums for a given match ID
getPlayerMatchsums(matches, token, host = "https://api.impect.com")getPlayerMatchsums(matches, token, host = "https://api.impect.com")
matches |
'IMPECT' match IDs |
token |
bearer token |
host |
host environment |
a dataframe containing the matchsums aggregated per player and position for the given match ID
# Toy example: this will error quickly (no API token) try(player_match_sums <- getPlayerMatchsums( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: player_match_sums <- getPlayerMatchsums( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(player_match_sums <- getPlayerMatchsums( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: player_match_sums <- getPlayerMatchsums( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)
Return a dataframe that contains all player profile scores for a given iteration ID
getPlayerProfileScores( iteration, positions, token, host = "https://api.impect.com" )getPlayerProfileScores( iteration, positions, token, host = "https://api.impect.com" )
iteration |
'IMPECT' iteration ID |
positions |
list of position names. Must be one of: "GOALKEEPER", "LEFT_WINGBACK_DEFENDER", "RIGHT_WINGBACK_DEFENDER", "CENTRAL_DEFENDER", "DEFENSE_MIDFIELD", "CENTRAL_MIDFIELD", "ATTACKING_MIDFIELD", "LEFT_WINGER", "RIGHT_WINGER", "CENTER_FORWARD" |
token |
bearer token |
host |
host environment |
a dataframe containing the player profilescores aggregated per player for the given iteration ID and list of positions
# Toy example: this will error quickly (no API token) try(player_profile_scores <- getPlayerProfileScores( iteration = 0, positions = c("INVALID_POSITION_1", "INVALID_POSITION_2"), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: player_profile_scores <- getPlayerProfileScores( iteration = 1004, positions = c("CENTRAL_DEFENDER", "DEFENSE_MIDFIELD"), token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(player_profile_scores <- getPlayerProfileScores( iteration = 0, positions = c("INVALID_POSITION_1", "INVALID_POSITION_2"), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: player_profile_scores <- getPlayerProfileScores( iteration = 1004, positions = c("CENTRAL_DEFENDER", "DEFENSE_MIDFIELD"), token = "yourToken" ) ## End(Not run)
Return a dataframe that contains all set pieces and aggregated kpi values per set piece sub phase for a set of given list of match IDs
getSetPieces(matches, token, host = "https://api.impect.com")getSetPieces(matches, token, host = "https://api.impect.com")
matches |
list fo 'IMPECT' match IDs |
token |
bearer token |
host |
host environment |
a dataframe containing all set pieces and aggregated kpi values per set piece sub phase for a set of given list of match IDs
# Toy example: this will error quickly (no API token) try(set_pieces <- getSetPieces( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: set_pieces <- getSetPieces( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(set_pieces <- getSetPieces( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: set_pieces <- getSetPieces( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)
Return a dataframe that contains squad ratings for a given iteration ID
getSquadCoefficients(iteration, token, host = "https://api.impect.com")getSquadCoefficients(iteration, token, host = "https://api.impect.com")
iteration |
'IMPECT' iteration ID |
token |
bearer token |
host |
host environment |
a dataframe containing the squad ratings for the given iteration ID
# Toy example: this will error quickly (no API token) try(squad_ratings <- getSquadRatings( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_ratings <- getSquadRatings( iteration = 1004, token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(squad_ratings <- getSquadRatings( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_ratings <- getSquadRatings( iteration = 1004, token = "yourToken" ) ## End(Not run)
Return a dataframe that contains all squads averages for a given iteration ID
getSquadIterationAverages(iteration, token, host = "https://api.impect.com")getSquadIterationAverages(iteration, token, host = "https://api.impect.com")
iteration |
'IMPECT' iteration ID |
token |
bearer token |
host |
host environment |
a dataframe containing the KPI averages aggregated per squad for the given iteration ID
# Toy example: this will error quickly (no API token) try(squad_avgs <- getSquadIterationAverages( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_avgs <- getSquadIterationAverages( iteration = 1004, token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(squad_avgs <- getSquadIterationAverages( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_avgs <- getSquadIterationAverages( iteration = 1004, token = "yourToken" ) ## End(Not run)
Return a dataframe that contains all squads scores for a given iteration ID
getSquadIterationScores(iteration, token, host = "https://api.impect.com")getSquadIterationScores(iteration, token, host = "https://api.impect.com")
iteration |
'IMPCET' iteration ID |
token |
bearer token |
host |
host environment |
a dataframe containing the squad scores aggregated per squad for the given iteration ID
# Toy example: this will error quickly (no API token) try(squad_scores <- getSquadIterationScores( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_scores <- getSquadIterationScores( iteration = 1004, token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(squad_scores <- getSquadIterationScores( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_scores <- getSquadIterationScores( iteration = 1004, token = "yourToken" ) ## End(Not run)
Return a dataframe that contains squad level scores and ratios for a given match ID
getSquadMatchScores(matches, token, host = "https://api.impect.com")getSquadMatchScores(matches, token, host = "https://api.impect.com")
matches |
'IMPECT' match IDs |
token |
bearer token |
host |
host environment |
a dataframe containing the scores and rations aggregated per squad for the given match ID
# Toy example: this will error quickly (no API token) try(squad_match_scores <- getSquadMatchScores( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_match_scores <- getSquadMatchScores( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(squad_match_scores <- getSquadMatchScores( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_match_scores <- getSquadMatchScores( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)
Return a dataframe that contains squad level matchsums for a given match ID
getSquadMatchsums(matches, token, host = "https://api.impect.com")getSquadMatchsums(matches, token, host = "https://api.impect.com")
matches |
'IMPECT' match IDs |
token |
bearer token |
host |
host environment |
a dataframe containing the matchsums aggregated per squad for the given match ID
# Toy example: this will error quickly (no API token) try(squad_match_sums <- getSquadMatchsums( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_match_sums <- getSquadMatchsums( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(squad_match_sums <- getSquadMatchsums( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_match_sums <- getSquadMatchsums( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)
Return a dataframe that contains squad ratings for a given iteration ID
getSquadRatings(iteration, token, host = "https://api.impect.com")getSquadRatings(iteration, token, host = "https://api.impect.com")
iteration |
'IMPECT' iteration ID |
token |
bearer token |
host |
host environment |
a dataframe containing the squad ratings for the given iteration ID
# Toy example: this will error quickly (no API token) try(squad_ratings <- getSquadRatings( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_ratings <- getSquadRatings( iteration = 1004, token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(squad_ratings <- getSquadRatings( iteration = 0, token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: squad_ratings <- getSquadRatings( iteration = 1004, token = "yourToken" ) ## End(Not run)
Return a dataframe that contains all starting positions for a set of given match IDs
getStartingPositions(matches, token, host = "https://api.impect.com")getStartingPositions(matches, token, host = "https://api.impect.com")
matches |
'IMPECT' match ID or a list of match IDs |
token |
bearer token |
host |
host environment |
a dataframe containing all starting positions for a set of given match IDs
# Toy example: this will error quickly (no API token) try(starting_pos <- getStartingPositions( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: starting_pos <- getStartingPositions( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(starting_pos <- getStartingPositions( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: starting_pos <- getStartingPositions( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)
Return a dataframe that contains all line-up changes for a set of given match IDs
getSubstitutions(matches, token, host = "https://api.impect.com")getSubstitutions(matches, token, host = "https://api.impect.com")
matches |
'IMPECT' match ID or a list of match IDs |
token |
bearer token |
host |
host environment |
a dataframe containing all line-up changes for a set of given match IDs
# Toy example: this will error quickly (no API token) try(subs <- getSubstitutions( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: subs <- getSubstitutions( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)# Toy example: this will error quickly (no API token) try(subs <- getSubstitutions( matches = c(0, 1), token = "invalid" )) # Real usage: requires valid Bearer Token from `getAccessToken()` ## Not run: subs <- getSubstitutions( matches = c(84248, 158150), token = "yourToken" ) ## End(Not run)
This class represents a token bucket, which is a rate limiting mechanism used to control the frequency of certain actions or requests based on available tokens. Tokens are added to the bucket at a specified rate and can be consumed when needed.
capacityThe maximum number of tokens in the bucket.
tokensThe number of tokens currently available in the bucket.
intervalThe duration in seconds after which the bucket gets refilled.
last_updateThe timestamp of the last update to the bucket.
try({ # create token bucket bucket <- TokenBucket( capacity = 10, tokens = 10, intervall = 1, last_update = Sys.Time() ) # add tokens to bucket bucket$addTokens() # check if a token is available bucket$isTokenAvailable # consume token bucket$consumeToken })try({ # create token bucket bucket <- TokenBucket( capacity = 10, tokens = 10, intervall = 1, last_update = Sys.Time() ) # add tokens to bucket bucket$addTokens() # check if a token is available bucket$isTokenAvailable # consume token bucket$consumeToken })