history

View team history matches ⬜ 🟨 🟦 🟩

GET https://api.soccerfootball.info/v1/teams/history/?i=ID

This endpoint returns with team data and its history matches. With parameter w you can define the time lapse "all" (from 2017 01 01), "1y" last year, "6m" last 6 months. The parameter l must be a language code getted from languages/list endpoint. Some elements such as championship and team names can be translated. Format response can be "json" or "csv" (Default "json")

Query Parameters

NameTypeDescription

t

string

Your API Token DIRECT API ONLY

f

string

Format response can be "json" or "csv" (default "json")

i

string

Team ID

w

string

When get time can be "all", "1y", "6m" (default value is "6m")

l

string

Language code (default value is "en_US")

Headers

NameTypeDescription

X-RapidAPI-Key

string

Your API token RAPIDAPI ONLY

X-RapidAPI-Host

string

soccerfootballinfo.rapidapi.com RAPIDAPI ONLY

{
   "status":200,
   "errors":[],
   "pagination":[],
   "result":[
      {
         "lapse":"6m",
         "results":{
            "win":28, // number of win in lapse
            "loss":2, // number of loss in lapse
            "draw":7 // number of draw in lapse
         },
         "macthes":[
            {
               "id":"5ff1096066d98235",
               "date":"2021-01-09 19:45:00",
               "championship":{
                  "id":"5fda5fab11fbd288",
                  "name":"Italy Serie A",
                  "s_name":"Serie A 20/21"
               },
               "teamA":{
                  "id":"5fda5fcad92584cd",
                  "name":"AC Milan",
                  "score":"2",
                  "1h_score": "1"
               },
               "teamB":{
                  "id":"5fda5fc4a7cbddf2",
                  "name":"Torino",
                  "score":"0",
                  "1h_score": "0"
               }
            },
            ...
         ]
      }
   ]
}

Example of code for direct API

$url = 'https://api.soccerfootball.info/v1/teams/history/?t=TOKEN&i=ID';

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => $url,
    CURLOPT_PROXY => null,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_CUSTOMREQUEST => "GET"
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if (!$err) {
  $result = json_decode($response);
  print_r($result);
} else {
    echo "cURL Error:" . $err;
}

Example of code for RapidAPI

$url = 'https://soccer-football-info.p.rapidapi.com/teams/history/?i=ID';

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => $url,
    CURLOPT_PROXY => null,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
        "X-RapidAPI-Host: soccer-football-info.p.rapidapi.com",
        "X-RapidAPI-Key: TOKEN"
    ],
));

$response = curl_exec($curl);
$err  = curl_error($curl);

curl_close($curl);

if (!$err) {
  $result = json_decode($response);
  print_r($result);
} else {
    echo "cURL Error:" . $err;
}

More example of code on rapidAPI

Last updated