The purpose of this API is to develop a tool to acquire information on world football.
Examples:
See all upcoming matches for Real Madrid
View the group stage results for last year’s UEFA Champion’s League
Check match schedules for English Premier League matchweek 11
Get all matches where Giorgi Mamardashvili was in the squad
For this guide, I will be doing a spin on example #1 by pulling up statistics and general information on Real Madrid’s previous matches from all competitions
Downloading the Data
We will bring in the tidyverse commands to help us view our CSV here as a data frame
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.2 ✔ tibble 3.3.0
✔ lubridate 1.9.4 ✔ tidyr 1.3.1
✔ purrr 1.1.0
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
For this API, the token is not part of the URL, rather it needs to be established as a header that will remain consistent regardless of what specific information is requested.
football_header <-add_headers("X-Auth-Token"="<YOUR API TOKEN>")
Choosing the Endpoint
The endpoint is the part of the URL that contains the category of info you want to retrieve. The website lists numerous endpoints, but I will be looking at match data for a particular team.
For this guide, I will be getting data for example #1: See all upcoming matches for Real Madrid