### Make GET Request with OkHttp in Java Source: https://www.api-football.com/documentation-v3 Example using OkHttp in Java to set up request headers, including the API key, for a GET request. ```Java var myHeaders = new Headers(); myHeaders.append("x-apisports-key", "XxXxXxXxXxXxXxXxXxXxXxXx"); var requestOptions = { method: 'GET', headers: myHeaders, redirect: 'follow' }; ``` -------------------------------- ### Cohttp request in OCaml Source: https://www.api-football.com/documentation-v3 OCaml example using the Cohttp library to make a GET request. It demonstrates setting headers and processing the response body. ```ocaml open Lwt open Cohttp open Cohttp_lwt_unix let reqBody = let uri = Uri.of_string "https://v3.football.api-sports.io/leagues" in let headers = Header.init () |> fun h -> Header.add h "x-apisports-key" "XxXxXxXxXxXxXxXxXxXxXxXx" in Client.call ~headers `GET uri >>= fun (_resp, body) -> body |> Cohttp_lwt.Body.to_string >|= fun body -> body let () = let respBody = Lwt_main.run reqBody in print_endline (respBody) ``` -------------------------------- ### Get Fixture Lineups with Parameters Source: https://www.api-football.com/documentation-v3 Use these examples to retrieve lineups for a specific fixture. You can filter by fixture ID, team ID, player ID, or lineup type (startXI). ```javascript // Get all available lineups from one {fixture} get("https://v3.football.api-sports.io/fixtures/lineups?fixture=592872"); ``` ```javascript // Get all available lineups from one {fixture} & {team} get("https://v3.football.api-sports.io/fixtures/lineups?fixture=592872&team=50"); ``` ```javascript // Get all available lineups from one {fixture} & {player} get("https://v3.football.api-sports.io/fixtures/lineups?fixture=215662&player=35845"); ``` ```javascript // Get all available lineups from one {fixture} & {type} get("https://v3.football.api-sports.io/fixtures/lineups?fixture=215662&type=startXI"); ``` ```javascript // It’s possible to make requests by mixing the available parameters get("https://v3.football.api-sports.io/fixtures/lineups?fixture=215662&player=35845&type=startXI"); ``` ```javascript get("https://v3.football.api-sports.io/fixtures/lineups?fixture=215662&team=463&type=startXI&player=35845"); ``` -------------------------------- ### Make GET Request with Unirest in Java Source: https://www.api-football.com/documentation-v3 Demonstrates using Unirest in Java to send a GET request, including the API key in the headers. ```Java Unirest.setTimeouts(0, 0); HttpResponse response = Unirest.get("https://v3.football.api-sports.io/leagues") .header("x-apisports-key", "XxXxXxXxXxXxXxXxXxXxXxXx") .asString(); ``` -------------------------------- ### Unirest request in Node.js Source: https://www.api-football.com/documentation-v3 This example shows how to use Unirest to send a GET request, including setting the API key in the headers. ```javascript var unirest = require('unirest'); var req = unirest('GET', 'https://v3.football.api-sports.io/leagues') .headers({ 'x-apisports-key': 'XxXxXxXxXxXxXxXxXxXxXxXx', }) .end(function (res) { if (res.error) throw new Error(res.error); console.log(res.raw_body); }); ``` -------------------------------- ### Retrieve Transfer Data via GET Request Source: https://www.api-football.com/documentation-v3 Examples showing how to query transfer information by specifying either a player ID or a team ID. ```javascript // Get all transfers from one {player} get("https://v3.football.api-sports.io/transfers?player=35845"); // Get all transfers from one {team} get("https://v3.football.api-sports.io/transfers?team=463"); ``` -------------------------------- ### Make GET Request with Go Source: https://www.api-football.com/documentation-v3 Native Go implementation for making a GET request to the API. Ensure the API key is included in the request headers. ```Go package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://v3.football.api-sports.io/leagues" method := "GET" client := &http.Client { } req, err := http.NewRequest(method, url, nil) if err != nil { fmt.Println(err) return } req.Header.Add("x-apisports-key", "XxXxXxXxXxXxXxXxXxXxXxXx") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Get All Leagues by Name Source: https://www.api-football.com/documentation-v3 Fetches all leagues that match a given league name. For example, 'premier league'. ```javascript // Get all leagues from one league {name} get("https://v3.football.api-sports.io/leagues?name=premier league"); ``` -------------------------------- ### NSURLSession request in Objective-C Source: https://www.api-football.com/documentation-v3 Objective-C example using NSURLSession to perform a GET request. It includes setting headers, handling the response, and managing the semaphore for asynchronous operations. ```objectivec #import dispatch_semaphore_t sema = dispatch_semaphore_create(0); NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://v3.football.api-sports.io/leagues"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0]; NSDictionary *headers = @{ @"x-apisports-key": @"XxXxXxXxXxXxXxXxXxXxXxXx", }; [request setAllHTTPHeaderFields:headers]; [request setHTTPMethod:@"GET"]; NSURLSession *session = [NSURLSession sharedSession]; NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { NSLog(@"%@", error); dispatch_semaphore_signal(sema); } else { NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response; NSError *parseError = nil; NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError]; NSLog(@"%@",responseDictionary); dispatch_semaphore_signal(sema); } }]; [dataTask resume]; dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); ``` -------------------------------- ### Live Odds Bet Values Example Source: https://www.api-football.com/documentation-v3 This JSON example shows how bet values are structured in the live odds endpoint, including 'main' and 'suspended' flags to indicate the primary bet to consider and its availability. ```json "id": 36, "name": "Over/Under Line", "values": [ { "value": "Over", "odd": "1.975", "handicap": "2", "main": true, // Bet to consider "suspended": false // True if this bet is temporarily suspended }, { "value": "Over", "odd": "3.45", "handicap": "2", "main": false, // Bet to no consider "suspended": false }, ] ``` -------------------------------- ### Retrieve leagues using Shell Source: https://www.api-football.com/documentation-v3 Command-line examples using httpie and wget. ```bash http --follow --timeout 3600 GET 'https://v3.football.api-sports.io/leagues' \ x-apisports-key:'XxXxXxXxXxXxXxXxXxXxXxXx' \ ``` ```bash wget --no-check-certificate --quiet \ --method GET \ --timeout=0 \ --header 'x-apisports-key: XxXxXxXxXxXxXxXxXxXxXxXx' \ 'https://v3.football.api-sports.io/leagues' ``` -------------------------------- ### Retrieve leagues using PHP Source: https://www.api-football.com/documentation-v3 Examples for making GET requests to the API-Football endpoint using PHP's cURL, HTTP_Request2, and pecl_http extensions. ```php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://v3.football.api-sports.io/leagues', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'x-apisports-key: XxXxXxXxXxXxXxXxXxXxXxXx', ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ``` ```php setUrl('https://v3.football.api-sports.io/leagues'); $request->setMethod(HTTP_Request2::METHOD_GET); $request->setConfig(array( 'follow_redirects' => TRUE )); $request->setHeader(array( 'x-apisports-key' => 'XxXxXxXxXxXxXxXxXxXxXxXx', )); try { $response = $request->send(); if ($response->getStatus() == 200) { echo $response->getBody(); } else { echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' . $response->getReasonPhrase(); } } catch(HTTP_Request2_Exception $e) { echo 'Error: ' . $e->getMessage(); } ``` ```php $client = new http\Client; $request = new http\Client\Request; $request->setRequestUrl('https://v3.football.api-sports.io/leagues'); $request->setRequestMethod('GET'); $request->setHeaders(array( 'x-apisports-key' => 'XxXxXxXxXxXxXxXxXxXxXxXx' )); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ``` -------------------------------- ### Make GET Request with libcurl in C Source: https://www.api-football.com/documentation-v3 Use libcurl to perform a GET request to the API. Ensure your API key is correctly set in the headers. ```C CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET"); curl_easy_setopt(curl, CURLOPT_URL, "https://v3.football.api-sports.io/leagues"); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https"); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "x-apisports-key: XxXxXxXxXxXxXxXxXxXxXxXx"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); res = curl_easy_perform(curl); } curl_easy_cleanup(curl); ``` -------------------------------- ### Get Trophies by Player or Coach ID Source: https://www.api-football.com/documentation-v3 Use these examples to fetch trophy data for specific players or coaches. You can query for single IDs or multiple IDs separated by hyphens. ```javascript // Get all trophies from one {player} get("https://v3.football.api-sports.io/trophies?player=276"); // Get all trophies from several {player} ids get("https://v3.football.api-sports.io/trophies?players=276-278"); // Get all trophies from one {coach} get("https://v3.football.api-sports.io/trophies?coach=2"); // Get all trophies from several {coach} ids get("https://v3.football.api-sports.io/trophies?coachs=2-6"); ``` -------------------------------- ### Retrieve leagues using Python Source: https://www.api-football.com/documentation-v3 Examples using the built-in http.client library and the popular requests library. ```python import http.client conn = http.client.HTTPSConnection("v3.football.api-sports.io") headers = { 'x-apisports-key': "XxXxXxXxXxXxXxXxXxXxXxXx" } conn.request("GET", "/leagues", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ```python url = "https://v3.football.api-sports.io/leagues" payload={} headers = { 'x-apisports-key': 'XxXxXxXxXxXxXxXxXxXxXxXx', } response = requests.request("GET", url, headers=headers, data=payload) print(response.text) ``` -------------------------------- ### Native HTTPS request in Node.js Source: https://www.api-football.com/documentation-v3 This example uses Node.js's built-in `https` module to make a GET request. It handles response data chunk by chunk and logs the final body. ```javascript var https = require('follow-redirects').https; var fs = require('fs'); var options = { 'method': 'GET', 'hostname': 'v3.football.api-sports.io', 'path': '/leagues', 'headers': { 'x-apisports-key': 'XxXxXxXxXxXxXxXxXxXxXxXx', }, 'maxRedirects': 20 }; var req = https.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function (chunk) { var body = Buffer.concat(chunks); console.log(body.toString()); }); res.on("error", function (error) { console.error(error); }); }); req.end(); ``` -------------------------------- ### Get Top Red Cards - PHP Request Sample Source: https://www.api-football.com/documentation-v3 This PHP code snippet demonstrates how to make a GET request to the '/players/topredcards' endpoint using the http client. Ensure you replace 'XxXxXxXxXxXxXxXxXxXxXxXx' with your actual API key. ```php $client = new http\Client; $request = new http\Client\Request; $request->setRequestUrl('https://v3.football.api-sports.io/players/topredcards'); $request->setRequestMethod('GET'); $request->setQuery(new http\QueryString(array( 'season' => '2020', 'league' => '61' ))); $request->setHeaders(array( 'x-apisports-key' => 'XxXxXxXxXxXxXxXxXxXxXxXx' )); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ``` -------------------------------- ### Get Fixtures by Date (JavaScript) Source: https://www.api-football.com/documentation-v3 Retrieve all available fixtures for a specific date. ```javascript // Get all available fixtures from one {date} get("https://v3.football.api-sports.io/fixtures?date=2019-10-22"); ``` -------------------------------- ### jQuery AJAX request in Javascript Source: https://www.api-football.com/documentation-v3 Utilize jQuery's AJAX method for making GET requests. This example shows how to configure the URL, method, and headers, including the API key. ```javascript var settings = { "url": "https://v3.football.api-sports.io/leagues", "method": "GET", "timeout": 0, "headers": { "x-apisports-key": "XxXxXxXxXxXxXxXxXxXxXxXx", }, }; $.ajax(settings).done(function (response) { console.log(response); }); ``` -------------------------------- ### Make GET Request with RestSharp in C# Source: https://www.api-football.com/documentation-v3 Utilize RestSharp to execute a GET request to the API. The API key must be included in the request headers. ```C# var client = new RestClient("https://v3.football.api-sports.io/leagues"); client.Timeout = -1; var request = new RestRequest(Method.GET); request.AddHeader("x-apisports-key", "XxXxXxXxXxXxXxXxXxXxXxXx"); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content); ``` -------------------------------- ### Retrieve Fixture Statistics Source: https://www.api-football.com/documentation-v3 Examples of requests to the fixtures/statistics endpoint with various query parameters. ```javascript // Get all available statistics from one {fixture} get("https://v3.football.api-sports.io/fixtures/statistics?fixture=215662"); // Get all available statistics from one {fixture} with Fulltime, First & Second Half data get("https://v3.football.api-sports.io/fixtures/statistics?fixture=215662&half=true"); // Get all available statistics from one {fixture} & {type} get("https://v3.football.api-sports.io/fixtures/statistics?fixture=215662&type=Total Shots"); // Get all available statistics from one {fixture} & {team} get("https://v3.football.api-sports.io/fixtures/statistics?fixture=215662&team=463"); ``` -------------------------------- ### Make GET Request with http in Dart Source: https://www.api-football.com/documentation-v3 Use the http package in Dart to send a GET request. The API key is passed in the request headers. ```Dart var headers = { 'x-apisports-key': 'XxXxXxXxXxXxXxXxXxXxXxXx', }; var request = http.Request('GET', Uri.parse('https://v3.football.api-sports.io/leagues')); request.headers.addAll(headers); http.StreamedResponse response = await request.send(); if (response.statusCode == 200) { print(await response.stream.bytesToString()); } else { print(response.reasonPhrase); } ``` -------------------------------- ### Retrieve Fixture Events Source: https://www.api-football.com/documentation-v3 Examples of requests to the fixtures/events endpoint, demonstrating parameter mixing for granular data retrieval. ```javascript // Get all available events from one {fixture} get("https://v3.football.api-sports.io/fixtures/events?fixture=215662"); // Get all available events from one {fixture} & {team} get("https://v3.football.api-sports.io/fixtures/events?fixture=215662&team=463"); // Get all available events from one {fixture} & {player} get("https://v3.football.api-sports.io/fixtures/events?fixture=215662&player=35845"); // Get all available events from one {fixture} & {type} get("https://v3.football.api-sports.io/fixtures/events?fixture=215662&type=card"); // It’s possible to make requests by mixing the available parameters get("https://v3.football.api-sports.io/fixtures/events?fixture=215662&player=35845&type=card"); get("https://v3.football.api-sports.io/fixtures/events?fixture=215662&team=463&type=goal&player=35845"); ``` -------------------------------- ### Retrieve Betting Markets via API Source: https://www.api-football.com/documentation-v3 Examples showing how to fetch all available bets, a specific bet by ID, or search for bets by name. ```javascript // Get all available bets get("https://v3.football.api-sports.io/odds/bets"); // Get bet from one {id} get("https://v3.football.api-sports.io/odds/bets?id=1"); // Allows you to search for a bet in relation to a bets {name} get("https://v3.football.api-sports.io/odds/bets?search=winner"); ``` -------------------------------- ### Retrieve Player Profiles Source: https://www.api-football.com/documentation-v3 Examples for fetching player data by ID, searching by name, or listing all players with pagination. ```javascript // Get data from one {player} get("https://v3.football.api-sports.io/players/profiles?player=276"); // Allows you to search for a player in relation to a player {lastname} get("https://v3.football.api-sports.io/players/profiles?search=ney"); // Get all available Players (limited to 250 results, use the pagination for next ones) get("https://v3.football.api-sports.io/players/profiles"); get("https://v3.football.api-sports.io/players/profiles?page=2"); get("https://v3.football.api-sports.io/players/profiles?page=3"); ``` -------------------------------- ### Retrieve Coach Information Source: https://www.api-football.com/documentation-v3 Examples for fetching coach data by ID, team, or name search. ```javascript // Get coachs from one coach {id} get("https://v3.football.api-sports.io/coachs?id=1"); // Get coachs from one {team} get("https://v3.football.api-sports.io/coachs?team=33"); // Allows you to search for a coach in relation to a coach {name} get("https://v3.football.api-sports.io/coachs?search=Klopp"); ``` -------------------------------- ### Get Next X Fixtures (JavaScript) Source: https://www.api-football.com/documentation-v3 Retrieve the next specified number of available fixtures. ```javascript // Get next X available fixtures get("https://v3.football.api-sports.io/fixtures?next=15"); ``` -------------------------------- ### GET /fixtures/lineups Source: https://www.api-football.com/documentation-v3 Fetches the lineups for a specific fixture. Requires a fixture ID. ```APIDOC ## GET /fixtures/lineups ### Description Retrieves the starting lineups and substitutes for a specified football match. ### Method GET ### Endpoint /fixtures/lineups ### Parameters #### Query Parameters - **fixture** (string) - Required - The ID of the fixture for which to retrieve lineups. ### Request Example ```json { "get": "fixtures/lineups", "parameters": { "fixture": "592872" } } ``` ### Response #### Success Response (200) - **team** (object) - Information about the team, including ID, name, logo, and color schemes. - **formation** (string) - The formation used by the team (e.g., "4-3-3"). - **startXI** (array) - An array of player objects representing the starting lineup. - **player** (object) - Details of the player, including ID, name, number, position, and grid position. - **substitutes** (array) - An array of player objects representing the substitutes. - **player** (object) - Details of the player, including ID, name, number, position, and grid position. - **coach** (object) - Information about the coach, including ID, name, and photo. #### Response Example ```json { "get": "fixtures/lineups", "parameters": { "fixture": "592872" }, "errors": [], "results": 2, "paging": { "current": 1, "total": 1 }, "response": [ { "team": { "id": 50, "name": "Manchester City", "logo": "https://media.api-sports.io/football/teams/50.png", "colors": { "player": { "primary": "5badff", "number": "ffffff", "border": "99ff99" }, "goalkeeper": { "primary": "99ff99", "number": "000000", "border": "99ff99" } } }, "formation": "4-3-3", "startXI": [ { "player": { "id": 617, "name": "Ederson", "number": 31, "pos": "G", "grid": "1:1" } }, { "player": { "id": 627, "name": "Kyle Walker", "number": 2, "pos": "D", "grid": "2:4" } } ], "substitutes": [ { "player": { "id": 50828, "name": "Zack Steffen", "number": 13, "pos": "G", "grid": null } } ], "coach": { "id": 4, "name": "Guardiola", "photo": "https://media.api-sports.io/football/coachs/4.png" } } ] } ``` #### Error Responses - **204**: No content (e.g., fixture not found or no lineups available). - **499**: Client closed request (rare). - **500**: Internal server error. ``` -------------------------------- ### XMLHttpRequest (XHR) in Javascript Source: https://www.api-football.com/documentation-v3 Demonstrates making a GET request using the native XMLHttpRequest object. Remember to set `xhr.withCredentials = true` and handle the response in the `readystatechange` event. ```javascript var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function() { if(this.readyState === 4) { console.log(this.responseText); } }); xhr.open("GET", "https://v3.football.api-sports.io/leagues"); xhr.setRequestHeader("x-apisports-key", "XxXxXxXxXxXxXxXxXxXxXxXx"); xhr.send(); ``` -------------------------------- ### Get Fixtures by League and Season (JavaScript) Source: https://www.api-football.com/documentation-v3 Retrieve all available fixtures for a specific league and season. ```javascript // Get all available fixtures from one {league} & {season} get("https://v3.football.api-sports.io/fixtures?league=39&season=2019"); ``` -------------------------------- ### GET /players/topyellowcards Source: https://www.api-football.com/documentation-v3 Get the 20 players with the most yellow cards for a league or cup. The ranking is determined by yellow cards, then red cards, then assists, and finally by fewest minutes played. ```APIDOC ## GET /players/topyellowcards ### Description Get the 20 players with the most yellow cards for a league or cup. ### Method GET ### Endpoint https://v3.football.api-sports.io/players/topyellowcards ### Parameters #### Query Parameters - **league** (integer) - Required - The id of the league - **season** (integer) - Required - The season of the league (YYYY format) #### Header Parameters - **x-apisports-key** (string) - Required - Your Api-Key ### Responses #### Success Response (200) OK #### Error Responses - **204** - No Content - **499** - Time Out - **500** - Internal Server Error ### Request Example ```php $client = new http\Client; $request = new http\Client\Request; $request->setRequestUrl('https://v3.football.api-sports.io/players/topyellowcards'); $request->setRequestMethod('GET'); $request->setQuery(new http\QueryString(array( 'season' => '2020', 'league' => '61' ))); $request->setHeaders(array( 'x-apisports-key' => 'XxXxXxXxXxXxXxXxXxXxXxXx' )); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ``` ``` -------------------------------- ### Example for Custom Translation with data-custom-lang Source: https://www.api-football.com/documentation-v3 Demonstrates using both data-lang and data-custom-lang attributes to load custom translations. The custom file takes precedence for any keys defined in both. ```html ``` -------------------------------- ### Retrieve Live Bets Source: https://www.api-football.com/documentation-v3 Examples for fetching all live bets, a specific bet by ID, or searching for bets by name. ```javascript // Get all available bets get("https://v3.football.api-sports.io/odds/live/bets"); // Get bet from one {id} get("https://v3.football.api-sports.io/odds/live/bets?id=1"); // Allows you to search for a bet in relation to a bets {name} get("https://v3.football.api-sports.io/odds/live/bets?search=winner"); ``` -------------------------------- ### League Seasons Response Source: https://www.api-football.com/documentation-v3 Example JSON response structure for the leagues/seasons endpoint. ```json { "get": "leagues/seasons", "parameters": [ ], "errors": [ ], "results": 12, "paging": { "current": 1, "total": 1 }, "response": [ 2008, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 ] } ``` -------------------------------- ### Teams Endpoint Response Source: https://www.api-football.com/documentation-v3 Example JSON response for a team query. ```json { "get": "teams", "parameters": { "id": "33" }, "errors": [ ], "results": 1, "paging": { "current": 1, "total": 1 }, "response": [ { "team": { "id": 33, "name": "Manchester United", "code": "MUN", "country": "England", "founded": 1878, "national": false, "logo": "https://media.api-sports.io/football/teams/33.png" }, "venue": { "id": 556, "name": "Old Trafford", "address": "Sir Matt Busby Way", "city": "Manchester", "capacity": 76212, "surface": "grass", "image": "https://media.api-sports.io/football/venues/556.png" } } ] } ``` -------------------------------- ### Fixture Response Sample (JSON) Source: https://www.api-football.com/documentation-v3 An example of a successful JSON response for a fixture request, showing details like fixture ID, venue, teams, goals, and score. ```json { "get": "fixtures", "parameters": { "live": "all" }, "errors": [ ], "results": 4, "paging": { "current": 1, "total": 1 }, "response": [ { "fixture": { "id": 239625, "referee": null, "timezone": "UTC", "date": "2020-02-06T14:00:00+00:00", "timestamp": 1580997600, "periods": { "first": 1580997600, "second": null }, "venue": { "id": 1887, "name": "Stade Municipal", "city": "Oued Zem" }, "status": { "long": "Halftime", "short": "HT", "elapsed": 45, "extra": null } }, "league": { "id": 200, "name": "Botola Pro", "country": "Morocco", "logo": "https://media.api-sports.io/football/leagues/115.png", "flag": "https://media.api-sports.io/flags/ma.svg", "season": 2019, "round": "Regular Season - 14" }, "teams": { "home": { "id": 967, "name": "Rapide Oued ZEM", "logo": "https://media.api-sports.io/football/teams/967.png", "winner": false }, "away": { "id": 968, "name": "Wydad AC", "logo": "https://media.api-sports.io/football/teams/968.png", "winner": true } }, "goals": { "home": 0, "away": 1 }, "score": { "halftime": { "home": 0, "away": 1 }, "fulltime": { "home": null, "away": null }, "extratime": { "home": null, "away": null }, "penalty": { "home": null, "away": null } } } ] } ``` -------------------------------- ### GET /odds Source: https://www.api-football.com/documentation-v3 Retrieves betting odds for a specific fixture and bookmaker. ```APIDOC ## GET /odds ### Description Retrieves betting odds for a specific football fixture from a selected bookmaker. ### Method GET ### Endpoint /odds ### Parameters #### Query Parameters - **fixture** (string) - Required - The unique identifier for the football fixture. - **bookmaker** (string) - Required - The unique identifier for the bookmaker. ### Response #### Success Response (200) - **league** (object) - League information including id, name, country, and season. - **fixture** (object) - Fixture details including id, timezone, date, and timestamp. - **bookmakers** (array) - List of bookmakers and their associated betting markets and odds. #### Response Example { "get": "odds", "parameters": { "fixture": "326090", "bookmaker": "6" }, "response": [ { "league": { "id": 116, "name": "Vysshaya Liga" }, "fixture": { "id": 326090 }, "bookmakers": [ { "id": 6, "name": "Bwin", "bets": [ { "id": 38, "name": "Exact Goals Number", "values": [ { "value": 4, "odd": "7.00" } ] } ] } ] } ] } ``` -------------------------------- ### GET /transfers Source: https://www.api-football.com/documentation-v3 Retrieves the transfer history for a specific player. ```APIDOC ## GET /transfers ### Description Retrieves the transfer history for a specific player. ### Method GET ### Endpoint /transfers ### Parameters #### Query Parameters - **player** (integer) - Required - The id of the player ### Response #### Success Response (200) - **player** (object) - Player identification details - **update** (string) - Last update timestamp - **transfers** (array) - List of transfer records #### Response Example { "get": "transfers", "parameters": { "player": "35845" }, "response": [ { "player": { "id": 35845, "name": "Hernán Darío Burbano" }, "transfers": [] } ] } ``` -------------------------------- ### Fetch League Seasons Request Source: https://www.api-football.com/documentation-v3 Example request to retrieve available seasons for leagues using PHP. ```php $client = new http\Client; $request = new http\Client\Request; $request->setRequestUrl('https://v3.football.api-sports.io/leagues/seasons'); $request->setRequestMethod('GET'); $request->setHeaders(array( 'x-apisports-key' => 'XxXxXxXxXxXxXxXxXxXxXxXx' )); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ``` -------------------------------- ### Requests library in Node.js Source: https://www.api-football.com/documentation-v3 Demonstrates making a GET request using the 'request' library in Node.js. The API key is passed in the headers object. ```javascript var request = require('request'); var options = { 'method': 'GET', 'url': 'https://v3.football.api-sports.io/leagues', 'headers': { 'x-apisports-key': 'XxXxXxXxXxXxXxXxXxXxXxXx', } }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); }); ``` -------------------------------- ### GET /odds/live Source: https://www.api-football.com/documentation-v3 Retrieves in-play odds for fixtures currently in progress or recently finished. ```APIDOC ## GET /odds/live ### Description Returns in-play odds for fixtures in progress. Fixtures are available from shortly before start until shortly after completion. No history is stored. ### Method GET ### Endpoint /odds/live ### Parameters #### Query Parameters - **fixture** (integer) - Optional - The id of the fixture - **league** (integer) - Optional - The id of the league - **bet** (integer) - Optional - The id of the bet ### Response #### Success Response (200) - **status** (object) - Contains stopped, blocked, and finished flags - **values** (array) - List of betting odds and handicaps ``` -------------------------------- ### Retrieve League Response Sample Source: https://www.api-football.com/documentation-v3 Example JSON response structure for a successful request to the leagues endpoint. ```json { * "get": "countries", * "parameters": { * "name": "england" }, * "errors": [ ], * "results": 1, * "paging": { * "current": 1, * "total": 1 }, * "response": [ * { * "name": "England", * "code": "GB", * "flag": "https://media.api-sports.io/flags/gb.svg" } ] } ``` -------------------------------- ### Retrieve Player Seasons Source: https://www.api-football.com/documentation-v3 Examples for fetching available seasons for player statistics, either globally or for a specific player ID. ```javascript // Get all seasons available for players endpoint get("https://v3.football.api-sports.io/players/seasons"); // Get all seasons available for a player {id} get("https://v3.football.api-sports.io/players/seasons?player=276"); ``` -------------------------------- ### Get Last X Fixtures (JavaScript) Source: https://www.api-football.com/documentation-v3 Retrieve the last specified number of available fixtures. ```javascript // Get last X available fixtures get("https://v3.football.api-sports.io/fixtures?last=15"); ``` -------------------------------- ### GET /trophies Source: https://www.api-football.com/documentation-v3 Retrieves all available trophies for a specific player or coach. ```APIDOC ## GET /trophies ### Description Get all available trophies for a player or a coach. ### Method GET ### Endpoint /trophies ### Parameters #### Query Parameters - **player** (integer) - Optional - The id of the player - **players** (string) - Optional - Maximum of 20 players ids (e.g., "id-id-id") - **coach** (integer) - Optional - The id of the coach - **coachs** (string) - Optional - Maximum of 20 coachs ids (e.g., "id-id-id") ### Response #### Success Response (200) - **OK** - Trophies data retrieved successfully ``` -------------------------------- ### GET /leagues/seasons Source: https://www.api-football.com/documentation-v3 Retrieves a list of all available seasons for leagues. ```APIDOC ## GET /leagues/seasons ### Description Retrieves a list of all available seasons for leagues. ### Method GET ### Endpoint https://v3.football.api-sports.io/leagues/seasons ### Parameters #### Header Parameters - **x-apisports-key** (string) - Required - Your Api-Key ### Response #### Success Response (200) - **response** (array) - List of available seasons (YYYY) #### Response Example { "get": "leagues/seasons", "parameters": [], "errors": [], "results": 12, "paging": { "current": 1, "total": 1 }, "response": [2008, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020] } ``` -------------------------------- ### GET odds/live Source: https://www.api-football.com/documentation-v3 Retrieves live odds for a specific fixture ID. ```APIDOC ## GET odds/live ### Description Retrieves the live odds for a specific football fixture by its ID. ### Method GET ### Endpoint odds/live ### Parameters #### Query Parameters - **fixture** (string) - Required - The unique identifier of the football fixture. ### Request Example { "fixture": "721238" } ### Response #### Success Response (200) - **response** (array) - List of odds data for the requested fixture. #### Response Example { "get": "odds/live", "parameters": { "fixture": "721238" }, "errors": [], "results": 1, "paging": { "current": 1, "total": 1 }, "response": [ { "fixture": { "id": 721238, "status": { "long": "Second Half", "elapsed": 62, "seconds": "62:14" } }, "odds": [ { "id": 20, "name": "Match Corners", "values": [] } ] } ] } ``` -------------------------------- ### Get Live Fixtures (JavaScript) Source: https://www.api-football.com/documentation-v3 Retrieve all currently live fixtures. This request returns event data for ongoing matches. ```javascript // Get all available fixtures in play // In this request events are returned in the response get("https://v3.football.api-sports.io/fixtures?live=all"); ``` -------------------------------- ### Make GET Request with cURL Source: https://www.api-football.com/documentation-v3 A simple cURL command to fetch data from the API. Remember to replace the placeholder with your actual API key. ```bash curl --request GET \ --url https://v3.football.api-sports.io/leagues \ --header 'x-apisports-key: XxXxXxXxXxXxXxXxXxXxXxXx' ``` -------------------------------- ### GET /leagues/seasons Source: https://www.api-football.com/documentation-v3 Retrieve the list of all available seasons in the API. ```APIDOC ## GET /leagues/seasons ### Description Get the list of available seasons. Seasons are represented as 4-digit keys. ### Method GET ### Endpoint https://v3.football.api-sports.io/leagues/seasons ### Parameters #### Header Parameters - **x-apisports-key** (string) - Required - Your API-Key ### Response #### Success Response (200) - **response** (array) - List of available season years. ``` -------------------------------- ### Retrieve Fixture Player Statistics Source: https://www.api-football.com/documentation-v3 Examples showing how to fetch player statistics for a specific fixture, with an optional filter for a specific team. ```javascript // Get all available players statistics from one {fixture} get("https://v3.football.api-sports.io/fixtures/players?fixture=169080"); // Get all available players statistics from one {fixture} & {team} get("https://v3.football.api-sports.io/fixtures/players?fixture=169080&team=2284"); ``` -------------------------------- ### GET /players/profiles Source: https://www.api-football.com/documentation-v3 Retrieves the profile information for a specific player or a list of players. ```APIDOC ## GET /players/profiles ### Description Retrieves player profile data. Supports searching by player ID or lastname. ### Method GET ### Endpoint https://v3.football.api-sports.io/players/profiles ### Parameters #### Header Parameters - **x-apisports-key** (string) - Required - Your Api-Key #### Query Parameters - **player** (integer) - Optional - The id of the player - **search** (string) - Optional - The lastname of the player (>= 3 characters) - **page** (integer) - Optional - Default: 1. Use for pagination ### Response #### Success Response (200) - **response** (array) - List of player profile objects #### Response Example { "response": [ { "player": { "id": 276, "name": "Neymar", "firstname": "Neymar", "lastname": "da Silva Santos Júnior", "age": 32, "nationality": "Brazil" } } ] } ``` -------------------------------- ### GET /venues Source: https://www.api-football.com/documentation-v3 Retrieves a list of available football venues based on provided filters. ```APIDOC ## GET /venues ### Description Get the list of available venues. The venue id are unique in the API. ### Method GET ### Endpoint https://v3.football.api-sports.io/venues ### Parameters #### Query Parameters - **id** (integer) - Optional - The id of the venue - **name** (string) - Optional - The name of the venue - **city** (string) - Optional - The city of the venue - **country** (string) - Optional - The country name of the venue - **search** (string) - Optional - The name, city or the country of the venue (>= 3 characters) #### Header Parameters - **x-apisports-key** (string) - Required - Your Api-Key ``` -------------------------------- ### Get All Leagues by Type Source: https://www.api-football.com/documentation-v3 Retrieves leagues filtered by their type, such as 'league' or 'cup'. ```javascript // Get all leagues from one {type} get("https://v3.football.api-sports.io/leagues?type=league"); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.