Live now!

Progress of current post

A Developer’s Guide to Using Sportmonks’ Football API with Julia. 

Julia is a high-level, general-purpose, dynamic programming language designed to be fast. It is well applied in fields related to data science, artificial intelligence, and machine learning, among several others.

Influenced by Python, R, and Ruby, Julia, whose development was led by the trio consisting of Jeff Bezanson, Stefan Karpinski, and Viral B. Shah, is suitable for web programming on both the server and client sides.

Time to read 15 min
Published 16 December 2024
Last updated 3 April 2025
David Jaja
A Developer’s Guide to Using Sportmonks’ Football API with Julia. 
Contents

What can you build with Julia?

Despite being unpopular in the mainstream programming industry, pharmaceutical companies such as Moderna, Pfizer, and AstraZeneca, all well-known makers of vaccines for COVID-19, use Julia extensively for drug development.

Julia has also been adopted in scientific computing and engineering, with the likes of Amazon, NASA, and the U.S. Air Force all making use of the programming language for various mission-critical software.

While its web-development community appears to be of limited size, a robust ecosystem for developing web applications in Julia exists, one of them being Genie, an open-source framework that can help you build production-ready, data-centric web apps.

Sportmonks Football API meets Julia.

Due to its speed, scalability, and versatility, Julia, like we said earlier, is an ideal choice for building server-side and web applications.

Just like we did in the previous episode of our guide using Scala, at the end of this guide, you will possess enough knowledge to retrieve data on any fixture in any league of your choice.

In the upcoming sections, we’ll walk you through configuring your development environment before making your first call to Sportmonks’ Football API to retrieve fixtures. As we drill down to details of a specific fixture in any league, each segment will build on the next, showcasing examples and code snippets.

Chapter 1: Setting up your environment

Before we get started, we will set up an environment to write and compile Julia.

1.1 Setting up an IDE for Julia.

If you took part in the exercises from the past episode, ‘Harnessing Sportmonks’ Football API with C#,’ you should have Visual Studio Code, which we downloaded from the official website, installed on your workstation.

Visual Studio Code (VSC) is a cross-platform IDE and an ideal solution for today’s exercise, as it is available on Mac, Windows, and Linux. Download and install VSC if required. However, before we can write and compile Julia, you will have to install an extension.

Julia Extension - VSC

Navigate to the extension section and search on the marketplace for Julia; select install.

Julia Extension - Installation

You may visit the official documentation page for alternative ways to install Julia on your workstation.

1.2 Getting Started with Julia

Now that we have our environment set up properly, we have to contend with authentication. We shall obtain an API token, which will be included in our URL to authenticate all our requests.

Authentication is required to ensure unauthorised access is prevented. You can read all about authentication on our documentation page.

1.3 Obtaining an API Token

To use the API, sign up for an account which automatically comes with the Danish Super Liga and Scottish Premier League plans. These are free forever.

However, for today’s exercise, you can take advantage of the 14-day free trial on any of the other plans if you haven’t done so earlier.

Head over to the Create an API Token section on the dashboard to create one.

Creat API Token_Sportmonks

Once you have your API token, which is required for authentication and accessing the data endpoints, you must keep it private. With your API token ready and your environment properly set up, you’re ready to begin making requests to Sportmonks’ Football API.

Chapter 2. Retrieving Fixtures using Julia.

In our last blog, where we made use of Scala, we began by retrieving seasons’ data from our API. However, in this guide, we will begin by retrieving data from the endpoint rightly named ‘fixtures’ before narrowing down to a specific fixture and retrieving statistics for a particular game.

Speaking about stats, we recently announced a boatload of new stats on our blog just a few weeks ago. These new additions, as many as 65 of them, empower our Football API for finer details. You can read all about them in this blog post.

Returning to the task at hand, our next piece of code will retrieve fixtures from our API.

using HTTP 

using JSON3 

# Define the API endpoint and token 

api_token = "API_Token"  # Replace this with your valid API token 

url = "https://api.sportmonks.com/v3/football/fixtures" 

# Construct the query string with just the API token 

query_params = Dict("api_token" => api_token) 

query_string = "?" * join(["$k=$v" for (k, v) in query_params], "&") 

full_url = url * query_string 

# Try-catch block for error handling 

try 

    response = HTTP.get(full_url) 

    # Check the response status 

    if response.status == 200 

        # Parse JSON response 

        data = JSON3.read(String(response.body)) 

        println("Data: ", data) 

    else 
        println("Request failed with status: ", response.status, " - ", String(response.body)) 

    end 

catch e 

    # Handle any errors 

    println("An error occurred: ", e) 

end

Data: {
           "data": [
                     {
                                           "id": 1,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1182,
                                         "name": "Bridgwater Town vs Bishop's Cleeve",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "Bishop's Cleeve won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 2,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 455,
                                         "name": "Cinderford Town vs Fleet Town",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "Cinderford Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 3,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 294,
                                         "name": "Evesham United vs Taunton Town",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "Game ended in draw.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 4,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": nothing,
                                         "name": "Godalming Town vs Paulton Rovers",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "Paulton Rovers won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 5,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1169,
                                         "name": "Mangotsfield United vs Guildford City",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "Mangotsfield United won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 6,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 549,
                                         "name": "North Leigh vs Merthyr Town",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "North Leigh won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 7,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1034,
                                         "name": "Shortwood United vs Didcot Town",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "Shortwood United won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 8,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 851,
                                         "name": "Swindon Supermarine vs Clevedon Town",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "Swindon Supermarine won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 9,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1171,
                                         "name": "Thatcham Town vs Stratford Town",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "Stratford Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 10,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": nothing,
                                         "name": "Tiverton Town vs Cirencester Town",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "Cirencester Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 11,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1163,
                                         "name": "Yate Town vs Wimborne Town",
                                  "starting_at": "2013-08-17 14:00:00",
                                  "result_info": "Yate Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376748000
                     },
                     {
                                           "id": 12,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1173,
                                         "name": "Clevedon Town vs Bridgwater Town",
                                  "starting_at": "2013-08-19 18:30:00",
                                  "result_info": "Bridgwater Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1376937000
                     },
                     {
                                           "id": 13,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1170,
                                         "name": "Bishop's Cleeve vs Cinderford Town",
                                  "starting_at": "2013-08-20 18:45:00",
                                  "result_info": "Cinderford Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377024300
                     },
                     {
                                           "id": 14,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 740,
                                         "name": "Cirencester Town vs Evesham United",
                                  "starting_at": "2013-08-20 18:45:00",
                                  "result_info": "Cirencester Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377024300
                     },
                     {
                                           "id": 15,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1053,
                                         "name": "Didcot Town vs Swindon Supermarine",
                                  "starting_at": "2013-08-20 18:45:00",
                                  "result_info": "Swindon Supermarine won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377024300
                     },
                     {
                                           "id": 16,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1192,
                                         "name": "Fleet Town vs North Leigh",
                                  "starting_at": "2013-08-20 18:45:00",
                                  "result_info": "Fleet Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377024300
                     },
                     {
                                           "id": 17,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1236,
                                         "name": "Merthyr Town vs Mangotsfield United",
                                  "starting_at": "2013-08-20 18:45:00",
                                  "result_info": "Merthyr Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377024300
                     },
                     {
                                           "id": 18,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 339790,
                                         "name": "Paulton Rovers vs Tiverton Town",
                                  "starting_at": "2013-08-20 18:45:00",
                                  "result_info": "Paulton Rovers won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377024300
                     },
                     {
                                           "id": 19,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1262,
                                         "name": "Stratford Town vs Shortwood United",
                                  "starting_at": "2013-08-20 18:45:00",
                                  "result_info": "Shortwood United won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377024300
                     },
                     {
                                           "id": 20,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1016,
                                         "name": "Taunton Town vs Yate Town",
                                  "starting_at": "2013-08-20 18:45:00",
                                  "result_info": "Game ended in draw.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377024300
                     },
                     {
                                           "id": 21,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1272,
                                         "name": "Wimborne Town vs Godalming Town",
                                  "starting_at": "2013-08-20 18:45:00",
                                  "result_info": "Wimborne Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377024300
                     },
                     {
                                           "id": 22,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1271,
                                         "name": "Guildford City vs Thatcham Town",
                                  "starting_at": "2013-08-21 18:45:00",
                                  "result_info": "Thatcham Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377110700
                     },
                     {
                                           "id": 23,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1170,
                                         "name": "Bishop's Cleeve vs Godalming Town",
                                  "starting_at": "2013-08-24 14:00:00",
                                  "result_info": "Bishop's Cleeve won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377352800
                     },
                     {
                                           "id": 24,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 740,
                                         "name": "Cirencester Town vs Bridgwater Town",
                                  "starting_at": "2013-08-24 14:00:00",
                                  "result_info": "Bridgwater Town won after full-time.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377352800
                     },
                     {
                                           "id": 25,
                                     "sport_id": 1,
                                    "league_id": 66,
                                    "season_id": 1,
                                     "stage_id": 1,
                                     "group_id": nothing,
                                 "aggregate_id": nothing,
                                     "round_id": nothing,
                                     "state_id": 5,
                                     "venue_id": 1173,
                                         "name": "Clevedon Town vs Thatcham Town",
                                  "starting_at": "2013-08-24 14:00:00",
                                  "result_info": "Game ended in draw.",
                                          "leg": "1/1",
                                      "details": nothing,
                                       "length": 90,
                                  "placeholder": false,
                                     "has_odds": false,
                             "has_premium_odds": false,
                        "starting_at_timestamp": 1377352800
                     }
                   ],
     "pagination": {
                             "count": 25,
                          "per_page": 25,
                      "current_page": 1,
                         "next_page": "https://api.sportmonks.com/v3/football/fixtures?page=2",
                          "has_more": true
                   },
   "subscription": [
                     {
                           "meta": {
                                          "trial_ends_at": "2024-10-16 14:50:45",
                                                "ends_at": nothing,
                                      "current_timestamp": 1734319941
                                   },
                          "plans": [
                                     {
                                            "plan": "Enterprise plan (loyal)",
                                           "sport": "Football",
                                        "category": "Advanced"
                                     },
                                     {
                                            "plan": "Enterprise Plan",
                                           "sport": "Cricket",
                                        "category": "Standard"
                                     },
                                     {
                                            "plan": "Formula One",
                                           "sport": "Formula One",
                                        "category": "Standard"
                                     }
                                   ],
                        "add_ons": [
                                     {
                                          "add_on": "All-in News API",
                                           "sport": "Football",
                                        "category": "News"
                                     },
                                     {
                                          "add_on": "pressure index add-on",
                                           "sport": "Football",
                                        "category": "Default"
                                     },
                                     {
                                          "add_on": "Enterprise Plan Predictions",
                                           "sport": "Football",
                                        "category": "Predictions"
                                     },
                                     {
                                          "add_on": "xG Advanced",
                                           "sport": "Football",
                                        "category": "Expected"
                                     }
                                   ],
                        "widgets": [
                                     {
                                        "widget": "Sportmonks Widgets",
                                         "sport": "Football"
                                     }
                                   ]
                     }
                   ],
     "rate_limit": {
                      "resets_in_seconds": 2903,
                              "remaining": 2997,
                       "requested_entity": "Fixture"
                   },
       "timezone": "UTC"
}

Explanation

Imports: using HTTP: Handles HTTP requests, while using JSON3: Parses JSON responses.

API Setup: The API token is defined as a string placeholder that has to be replaced with a valid token which you created in chapter 1.3. The base URL for the fixtures’ endpoint is https://api.sportmonks.com/v3/football/fixtures.

Query parameters are constructed using a dictionary containing the API token. The full URL Construction is a query string built by joining the API token with the URL.

We then implemented error handling with a Try-Catch: A try block attempts to send an HTTP GET request to the constructed URL. The response is checked: If the status is 200 (OK), the JSON response is parsed using JSON3.read() and printed.

Otherwise, it prints an error message with the HTTP status and response body.

Any unexpected errors are caught and logged in the catch block, which you can cross-reference with the error codes from our documentation page.

Barring any error, it pretty prints the JSON response in a readable format.

Chapter 3.0 Retrieve a Specific Fixture.

In this chapter we will narrow down to a specific fixture of interest, namely the recent El Clásico, which was played on the 26th of October 2024, where Real Madrid were picked apart by Barcelona in a 4-0 loss.

Perhaps your current plan does not cover La Liga; there is no need to break a sweat, as you can achieve the same result by replacing the fixture ID with one covered by your current plan.

Head over to the ID Finder on your dashboard and navigate to the current La Liga season if available on your plan. If not, select any fixture of your choice from a league covered by your current plan and replicate the exercises using the fixture ID.

Real Madrid-vs-Barcelona

The first episode of El Clásico in La Liga this season was played in Round 11. After looking through the list of fixtures for Round 11, you will find the ID for the match Real Madrid vs. Barcelona as 19135354.

We will need this in the next few sections.

Chapter 3.1 Get Fixture by ID.

Using the same piece of code from the previous section, all we need to do is add the fixture ID at the end of the base URL in line 9: https://api.sportmonks.com/v3/football/fixtures/19135354, and we will have our result printed neatly like we had earlier.

using HTTP 

using JSON3 

# Define the API endpoint and token 

api_token = "API Token"  # Replace this with your valid API token 

url = "https://api.sportmonks.com/v3/football/fixtures/19135354" 
 

# Construct the query string with just the API token 

query_params = Dict("api_token" => api_token) 

query_string = "?" * join(["$k=$v" for (k, v) in query_params], "&") 

full_url = url * query_string 

 

# Try-catch block for error handling 

try 

    response = HTTP.get(full_url) 

     

    # Check the response status 

    if response.status == 200 

        # Parse JSON response 

        data = JSON3.read(String(response.body)) 

        println("Data: ", data) 

    else 

        println("Request failed with status: ", response.status, " - ", String(response.body)) 

    end 

catch e 

    # Handle any errors 

    println("An error occurred: ", e) 

end 

Data: {
           "data": {
                                         "id": 19135354,
                                   "sport_id": 1,
                                  "league_id": 564,
                                  "season_id": 23621,
                                   "stage_id": 77471332,
                                   "group_id": nothing,
                               "aggregate_id": nothing,
                                   "round_id": 339304,
                                   "state_id": 5,
                                   "venue_id": 2020,
                                       "name": "Real Madrid vs FC Barcelona",
                                "starting_at": "2024-10-26 19:00:00",
                                "result_info": "FC Barcelona won after full-time.",
                                        "leg": "1/1",
                                    "details": nothing,
                                     "length": 90,
                                "placeholder": false,
                                   "has_odds": true,
                           "has_premium_odds": true,
                      "starting_at_timestamp": 1729969200
                   },
   "subscription": [
                     {
                           "meta": {
                                          "trial_ends_at": "2024-10-16 14:50:45",
                                                "ends_at": nothing,
                                      "current_timestamp": 1734325003
                                   },
                          "plans": [
                                     {
                                            "plan": "Enterprise plan (loyal)",
                                           "sport": "Football",
                                        "category": "Advanced"
                                     },
                                     {
                                            "plan": "Enterprise Plan",
                                           "sport": "Cricket",
                                        "category": "Standard"
                                     },
                                     {
                                            "plan": "Formula One",
                                           "sport": "Formula One",
                                        "category": "Standard"
                                     }
                                   ],
                        "add_ons": [
                                     {
                                          "add_on": "All-in News API",
                                           "sport": "Football",
                                        "category": "News"
                                     },
                                     {
                                          "add_on": "pressure index add-on",
                                           "sport": "Football",
                                        "category": "Default"
                                     },
                                     {
                                          "add_on": "Enterprise Plan Predictions",
                                           "sport": "Football",
                                        "category": "Predictions"
                                     },
                                     {
                                          "add_on": "xG Advanced",
                                           "sport": "Football",
                                        "category": "Expected"
                                     }
                                   ],
                        "widgets": [
                                     {
                                        "widget": "Sportmonks Widgets",
                                         "sport": "Football"
                                     }
                                   ]
                     }
                   ],
     "rate_limit": {
                      "resets_in_seconds": 1895,
                              "remaining": 2995,
                       "requested_entity": "Fixture"
                   },
       "timezone": "UTC"
}

As you can see from the result the url and fixture ID retrieves the details of a specific fixture, in this case El Clásico.

Chapter 4 Adding useful information.

Just like we did in our previous blog, where we made of Kotlin, you can enrich your request with includes and filters. ‘Include’ is a powerful tool built into our Football API to improve the ease of retrieving additional information.

Among them are scores, participants, statistics.type, events, and line-ups. We shall add the scores for El Clásico in the next section using an include.

Chapter 4.1 Adding Results

We will have to modify our previous piece of code to include scores in our results. Here is our URL of interest.

https://api.sportmonks.com/v3/football/fixtures/19135354?api_token=API_Token&include=scores

using HTTP 

using JSON3 

# Define the API endpoint and token 

api_token = "API Token"  # Your valid API token 

url = "https://api.sportmonks.com/v3/football/fixtures/19135354" 

# Construct the query string with the API token and 'include=scores' 

query_params = Dict("api_token" => api_token, "include" => "scores") 

query_string = "?" * join(["$k=$v" for (k, v) in query_params], "&") 

full_url = url * query_string 

# Try-catch block for error handling 

try 

    response = HTTP.get(full_url) 

    # Check the response status 

    if response.status == 200 

        # Parse JSON response 

        data = JSON3.read(String(response.body)) 

        println("Data: ", data) 

    else 

        println("Request failed with status: ", response.status, " - ", String(response.body)) 

    end 

catch e 

    # Handle any errors 

    println("An error occurred: ", e) 

end 

Data: {
           "data": {
                                         "id": 19135354,
                                   "sport_id": 1,
                                  "league_id": 564,
                                  "season_id": 23621,
                                   "stage_id": 77471332,
                                   "group_id": nothing,
                               "aggregate_id": nothing,
                                   "round_id": 339304,
                                   "state_id": 5,
                                   "venue_id": 2020,
                                       "name": "Real Madrid vs FC Barcelona",
                                "starting_at": "2024-10-26 19:00:00",
                                "result_info": "FC Barcelona won after full-time.",
                                        "leg": "1/1",
                                    "details": nothing,
                                     "length": 90,
                                "placeholder": false,
                                   "has_odds": true,
                           "has_premium_odds": true,
                      "starting_at_timestamp": 1729969200,
                                     "scores": [
                                                 {
                                                                "id": 15105729,
                                                        "fixture_id": 19135354,
                                                           "type_id": 1,
                                                    "participant_id": 83,
                                                             "score": {
                                                                               "goals": 0,
                                                                         "participant": "away"
                                                                      },
                                                       "description": "1ST_HALF"
                                                 },
                                                 {
                                                                "id": 15105728,
                                                        "fixture_id": 19135354,
                                                           "type_id": 1,
                                                    "participant_id": 3468,
                                                             "score": {
                                                                               "goals": 0,
                                                                         "participant": "home"
                                                                      },
                                                       "description": "1ST_HALF"
                                                 },
                                                 {
                                                                "id": 15105732,
                                                        "fixture_id": 19135354,
                                                           "type_id": 1525,
                                                    "participant_id": 83,
                                                             "score": {
                                                                               "goals": 4,
                                                                         "participant": "away"
                                                                      },
                                                       "description": "CURRENT"
                                                 },
                                                 {
                                                                "id": 15105838,
                                                        "fixture_id": 19135354,
                                                           "type_id": 2,
                                                    "participant_id": 3468,
                                                             "score": {
                                                                               "goals": 0,
                                                                         "participant": "home"
                                                                      },
                                                       "description": "2ND_HALF"
                                                 },
                                                 {
                                                                "id": 15105839,
                                                        "fixture_id": 19135354,
                                                           "type_id": 2,
                                                    "participant_id": 83,
                                                             "score": {
                                                                               "goals": 4,
                                                                         "participant": "away"
                                                                      },
                                                       "description": "2ND_HALF"
                                                 },
                                                 {
                                                                "id": 15105733,
                                                        "fixture_id": 19135354,
                                                           "type_id": 1525,
                                                    "participant_id": 3468,
                                                             "score": {
                                                                               "goals": 0,
                                                                         "participant": "home"
                                                                      },
                                                       "description": "CURRENT"
                                                 }
                                               ]
                   },
   "subscription": [
                     {
                           "meta": {
                                          "trial_ends_at": "2024-10-16 14:50:45",
                                                "ends_at": nothing,
                                      "current_timestamp": 1734346151
                                   },
                          "plans": [
                                     {
                                            "plan": "Enterprise plan (loyal)",
                                           "sport": "Football",
                                        "category": "Advanced"
                                     },
                                     {
                                            "plan": "Enterprise Plan",
                                           "sport": "Cricket",
                                        "category": "Standard"
                                     },
                                     {
                                            "plan": "Formula One",
                                           "sport": "Formula One",
                                        "category": "Standard"
                                     }
                                   ],
                        "add_ons": [
                                     {
                                          "add_on": "All-in News API",
                                           "sport": "Football",
                                        "category": "News"
                                     },
                                     {
                                          "add_on": "pressure index add-on",
                                           "sport": "Football",
                                        "category": "Default"
                                     },
                                     {
                                          "add_on": "Enterprise Plan Predictions",
                                           "sport": "Football",
                                        "category": "Predictions"
                                     },
                                     {
                                          "add_on": "xG Advanced",
                                           "sport": "Football",
                                        "category": "Expected"
                                     }
                                   ],
                        "widgets": [
                                     {
                                        "widget": "Sportmonks Widgets",
                                         "sport": "Football"
                                     }
                                   ]
                     }
                   ],
     "rate_limit": {
                      "resets_in_seconds": 3600,
                              "remaining": 2999,
                       "requested_entity": "Fixture"
                   },
       "timezone": "UTC"
}

Chapter 4.2 Add Other Statistics

Adding other statistics requires we use the type statistics.type in our url to replace scores.

using HTTP 

using JSON3 

# Define the API endpoint and token 

api_token = "API Token"  # Replace with your valid API token 

url = "https://api.sportmonks.com/v3/football/fixtures/19135354"  

# Construct the query string with the API token and 'include=scores' 

query_params = Dict("api_token" => api_token, "include" => "statistics.type") 

query_string = "?" * join(["$k=$v" for (k, v) in query_params], "&") 

full_url = url * query_string 

 

# Try-catch block for error handling 

try 

    response = HTTP.get(full_url) 

     

    # Check the response status 

    if response.status == 200 

        # Parse JSON response 

        data = JSON3.read(String(response.body)) 

        println("Data: ", data) 

    else 

        println("Request failed with status: ", response.status, " - ", String(response.body)) 

    end 

catch e 

    # Handle any errors 

    println("An error occurred: ", e) 

end 

{
  "data": {
    "id": 19135354,
    "sport_id": 1,
    "league_id": 564,
    "season_id": 23621,
    "stage_id": 77471332,
    "group_id": null,
    "aggregate_id": null,
    "round_id": 339304,
    "state_id": 5,
    "venue_id": 2020,
    "name": "Real Madrid vs FC Barcelona",
    "starting_at": "2024-10-26 19:00:00",
    "result_info": "FC Barcelona won after full-time.",
    "leg": "1/1",
    "details": null,
    "length": 90,
    "placeholder": false,
    "has_odds": true,
    "has_premium_odds": true,
    "starting_at_timestamp": 1729969200,
    "statistics": [
      {
        "id": 123987025,
        "fixture_id": 19135354,
        "type_id": 54,
        "participant_id": 83,
        "data": {
          "value": 15
        },
        "location": "away",
        "type": {
          "id": 54,
          "name": "Goal Attempts",
          "code": "goal-attempts",
          "developer_name": "GOAL_ATTEMPTS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123986987,
        "fixture_id": 19135354,
        "type_id": 46,
        "participant_id": 3468,
        "data": {
          "value": 67
        },
        "location": "home",
        "type": {
          "id": 46,
          "name": "Ball Safe",
          "code": "ball-safe",
          "developer_name": "BALL_SAFE",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123987022,
        "fixture_id": 19135354,
        "type_id": 87,
        "participant_id": 83,
        "data": {
          "value": 2
        },
        "location": "away",
        "type": {
          "id": 87,
          "name": "Injuries",
          "code": "injuries",
          "developer_name": "INJURIES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123986957,
        "fixture_id": 19135354,
        "type_id": 87,
        "participant_id": 3468,
        "data": {
          "value": 0
        },
        "location": "home",
        "type": {
          "id": 87,
          "name": "Injuries",
          "code": "injuries",
          "developer_name": "INJURIES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123987019,
        "fixture_id": 19135354,
        "type_id": 46,
        "participant_id": 83,
        "data": {
          "value": 72
        },
        "location": "away",
        "type": {
          "id": 46,
          "name": "Ball Safe",
          "code": "ball-safe",
          "developer_name": "BALL_SAFE",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123987017,
        "fixture_id": 19135354,
        "type_id": 54,
        "participant_id": 3468,
        "data": {
          "value": 11
        },
        "location": "home",
        "type": {
          "id": 54,
          "name": "Goal Attempts",
          "code": "goal-attempts",
          "developer_name": "GOAL_ATTEMPTS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775366,
        "fixture_id": 19135354,
        "type_id": 52,
        "participant_id": 83,
        "data": {
          "value": 4
        },
        "location": "away",
        "type": {
          "id": 52,
          "name": "Goals",
          "code": "goals",
          "developer_name": "GOALS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775343,
        "fixture_id": 19135354,
        "type_id": 43,
        "participant_id": 3468,
        "data": {
          "value": 64
        },
        "location": "home",
        "type": {
          "id": 43,
          "name": "Attacks",
          "code": "attacks",
          "developer_name": "ATTACKS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775779,
        "fixture_id": 19135354,
        "type_id": 45,
        "participant_id": 3468,
        "data": {
          "value": 42
        },
        "location": "home",
        "type": {
          "id": 45,
          "name": "Ball Possession %",
          "code": "ball-possession",
          "developer_name": "BALL_POSSESSION",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123776899,
        "fixture_id": 19135354,
        "type_id": 98,
        "participant_id": 83,
        "data": {
          "value": 12
        },
        "location": "away",
        "type": {
          "id": 98,
          "name": "Total Crosses",
          "code": "total-crosses",
          "developer_name": "TOTAL_CROSSES",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775344,
        "fixture_id": 19135354,
        "type_id": 82,
        "participant_id": 3468,
        "data": {
          "value": 78
        },
        "location": "home",
        "type": {
          "id": 82,
          "name": "Successful Passes Percentage",
          "code": "successful-passes-percentage",
          "developer_name": "SUCCESSFUL_PASSES_PERCENTAGE",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775808,
        "fixture_id": 19135354,
        "type_id": 50,
        "participant_id": 3468,
        "data": {
          "value": 4
        },
        "location": "home",
        "type": {
          "id": 50,
          "name": "Shots Outsidebox",
          "code": "shots-outsidebox",
          "developer_name": "SHOTS_OUTSIDEBOX",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775375,
        "fixture_id": 19135354,
        "type_id": 82,
        "participant_id": 83,
        "data": {
          "value": 84
        },
        "location": "away",
        "type": {
          "id": 82,
          "name": "Successful Passes Percentage",
          "code": "successful-passes-percentage",
          "developer_name": "SUCCESSFUL_PASSES_PERCENTAGE",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775354,
        "fixture_id": 19135354,
        "type_id": 52,
        "participant_id": 3468,
        "data": {
          "value": 0
        },
        "location": "home",
        "type": {
          "id": 52,
          "name": "Goals",
          "code": "goals",
          "developer_name": "GOALS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775361,
        "fixture_id": 19135354,
        "type_id": 43,
        "participant_id": 83,
        "data": {
          "value": 87
        },
        "location": "away",
        "type": {
          "id": 43,
          "name": "Attacks",
          "code": "attacks",
          "developer_name": "ATTACKS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775363,
        "fixture_id": 19135354,
        "type_id": 47,
        "participant_id": 83,
        "data": {
          "value": 0
        },
        "location": "away",
        "type": {
          "id": 47,
          "name": "Penalties",
          "code": "penalties",
          "developer_name": "PENALTIES",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775350,
        "fixture_id": 19135354,
        "type_id": 84,
        "participant_id": 3468,
        "data": {
          "value": 2
        },
        "location": "home",
        "type": {
          "id": 84,
          "name": "Yellowcards",
          "code": "yellowcards",
          "developer_name": "YELLOWCARDS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775810,
        "fixture_id": 19135354,
        "type_id": 45,
        "participant_id": 83,
        "data": {
          "value": 58
        },
        "location": "away",
        "type": {
          "id": 45,
          "name": "Ball Possession %",
          "code": "ball-possession",
          "developer_name": "BALL_POSSESSION",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775359,
        "fixture_id": 19135354,
        "type_id": 83,
        "participant_id": 3468,
        "data": {
          "value": 0
        },
        "location": "home",
        "type": {
          "id": 83,
          "name": "Redcards",
          "code": "redcards",
          "developer_name": "REDCARDS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775807,
        "fixture_id": 19135354,
        "type_id": 58,
        "participant_id": 3468,
        "data": {
          "value": 1
        },
        "location": "home",
        "type": {
          "id": 58,
          "name": "Shots Blocked",
          "code": "shots-blocked",
          "developer_name": "SHOTS_BLOCKED",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775365,
        "fixture_id": 19135354,
        "type_id": 41,
        "participant_id": 83,
        "data": {
          "value": 7
        },
        "location": "away",
        "type": {
          "id": 41,
          "name": "Shots Off Target",
          "code": "shots-off-target",
          "developer_name": "SHOTS_OFF_TARGET",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123777348,
        "fixture_id": 19135354,
        "type_id": 51,
        "participant_id": 83,
        "data": {
          "value": 1
        },
        "location": "away",
        "type": {
          "id": 51,
          "name": "Offsides",
          "code": "offsides",
          "developer_name": "OFFSIDES",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123778542,
        "fixture_id": 19135354,
        "type_id": 56,
        "participant_id": 3468,
        "data": {
          "value": 15
        },
        "location": "home",
        "type": {
          "id": 56,
          "name": "Fouls",
          "code": "fouls",
          "developer_name": "FOULS",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123775815,
        "fixture_id": 19135354,
        "type_id": 64,
        "participant_id": 83,
        "data": {
          "value": 1
        },
        "location": "away",
        "type": {
          "id": 64,
          "name": "Hit Woodwork",
          "code": "hit-woodwork",
          "developer_name": "HIT_WOODWORK",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775341,
        "fixture_id": 19135354,
        "type_id": 47,
        "participant_id": 3468,
        "data": {
          "value": 0
        },
        "location": "home",
        "type": {
          "id": 47,
          "name": "Penalties",
          "code": "penalties",
          "developer_name": "PENALTIES",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775346,
        "fixture_id": 19135354,
        "type_id": 60,
        "participant_id": 3468,
        "data": {
          "value": 18
        },
        "location": "home",
        "type": {
          "id": 60,
          "name": "Throwins",
          "code": "throwins",
          "developer_name": "THROWINS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123794189,
        "fixture_id": 19135354,
        "type_id": 117,
        "participant_id": 83,
        "data": {
          "value": 12
        },
        "location": "away",
        "type": {
          "id": 117,
          "name": "Key Passes",
          "code": "key-passes",
          "developer_name": "KEY_PASSES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775339,
        "fixture_id": 19135354,
        "type_id": 41,
        "participant_id": 3468,
        "data": {
          "value": 4
        },
        "location": "home",
        "type": {
          "id": 41,
          "name": "Shots Off Target",
          "code": "shots-off-target",
          "developer_name": "SHOTS_OFF_TARGET",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775370,
        "fixture_id": 19135354,
        "type_id": 59,
        "participant_id": 83,
        "data": {
          "value": 3
        },
        "location": "away",
        "type": {
          "id": 59,
          "name": "Substitutions",
          "code": "substitutions",
          "developer_name": "SUBSTITUTIONS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775373,
        "fixture_id": 19135354,
        "type_id": 84,
        "participant_id": 83,
        "data": {
          "value": 5
        },
        "location": "away",
        "type": {
          "id": 84,
          "name": "Yellowcards",
          "code": "yellowcards",
          "developer_name": "YELLOWCARDS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123778066,
        "fixture_id": 19135354,
        "type_id": 70,
        "participant_id": 83,
        "data": {
          "value": 12
        },
        "location": "away",
        "type": {
          "id": 70,
          "name": "Headers",
          "code": "headers",
          "developer_name": "HEADERS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775358,
        "fixture_id": 19135354,
        "type_id": 59,
        "participant_id": 3468,
        "data": {
          "value": 3
        },
        "location": "home",
        "type": {
          "id": 59,
          "name": "Substitutions",
          "code": "substitutions",
          "developer_name": "SUBSTITUTIONS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123776898,
        "fixture_id": 19135354,
        "type_id": 98,
        "participant_id": 3468,
        "data": {
          "value": 16
        },
        "location": "home",
        "type": {
          "id": 98,
          "name": "Total Crosses",
          "code": "total-crosses",
          "developer_name": "TOTAL_CROSSES",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123783450,
        "fixture_id": 19135354,
        "type_id": 77,
        "participant_id": 3468,
        "data": {
          "value": 14
        },
        "location": "home",
        "type": {
          "id": 77,
          "name": "Challenges",
          "code": "challenges",
          "developer_name": "CHALLENGES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123783470,
        "fixture_id": 19135354,
        "type_id": 100,
        "participant_id": 3468,
        "data": {
          "value": 14
        },
        "location": "home",
        "type": {
          "id": 100,
          "name": "Interceptions",
          "code": "interceptions",
          "developer_name": "INTERCEPTIONS",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123751235,
        "fixture_id": 19135354,
        "type_id": 42,
        "participant_id": 83,
        "data": {
          "value": 15
        },
        "location": "away",
        "type": {
          "id": 42,
          "name": "Shots Total",
          "code": "shots-total",
          "developer_name": "SHOTS_TOTAL",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123779713,
        "fixture_id": 19135354,
        "type_id": 62,
        "participant_id": 83,
        "data": {
          "value": 24
        },
        "location": "away",
        "type": {
          "id": 62,
          "name": "Long Passes",
          "code": "long-passes",
          "developer_name": "LONG_PASSES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123751234,
        "fixture_id": 19135354,
        "type_id": 42,
        "participant_id": 3468,
        "data": {
          "value": 9
        },
        "location": "home",
        "type": {
          "id": 42,
          "name": "Shots Total",
          "code": "shots-total",
          "developer_name": "SHOTS_TOTAL",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775584,
        "fixture_id": 19135354,
        "type_id": 80,
        "participant_id": 3468,
        "data": {
          "value": 311
        },
        "location": "home",
        "type": {
          "id": 80,
          "name": "Passes",
          "code": "passes",
          "developer_name": "PASSES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775356,
        "fixture_id": 19135354,
        "type_id": 55,
        "participant_id": 3468,
        "data": {
          "value": 18
        },
        "location": "home",
        "type": {
          "id": 55,
          "name": "Free Kicks",
          "code": "free-kicks",
          "developer_name": "FREE_KICKS",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123775364,
        "fixture_id": 19135354,
        "type_id": 86,
        "participant_id": 83,
        "data": {
          "value": 7
        },
        "location": "away",
        "type": {
          "id": 86,
          "name": "Shots On Target",
          "code": "shots-on-target",
          "developer_name": "SHOTS_ON_TARGET",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775369,
        "fixture_id": 19135354,
        "type_id": 34,
        "participant_id": 83,
        "data": {
          "value": 3
        },
        "location": "away",
        "type": {
          "id": 34,
          "name": "Corners",
          "code": "corners",
          "developer_name": "CORNERS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775351,
        "fixture_id": 19135354,
        "type_id": 44,
        "participant_id": 3468,
        "data": {
          "value": 37
        },
        "location": "home",
        "type": {
          "id": 44,
          "name": "Dangerous Attacks",
          "code": "dangerous-attacks",
          "developer_name": "DANGEROUS_ATTACKS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775814,
        "fixture_id": 19135354,
        "type_id": 81,
        "participant_id": 83,
        "data": {
          "value": 380
        },
        "location": "away",
        "type": {
          "id": 81,
          "name": "Successful Passes",
          "code": "successful-passes",
          "developer_name": "SUCCESSFUL_PASSES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123778543,
        "fixture_id": 19135354,
        "type_id": 56,
        "participant_id": 83,
        "data": {
          "value": 17
        },
        "location": "away",
        "type": {
          "id": 56,
          "name": "Fouls",
          "code": "fouls",
          "developer_name": "FOULS",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123775349,
        "fixture_id": 19135354,
        "type_id": 34,
        "participant_id": 3468,
        "data": {
          "value": 10
        },
        "location": "home",
        "type": {
          "id": 34,
          "name": "Corners",
          "code": "corners",
          "developer_name": "CORNERS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775362,
        "fixture_id": 19135354,
        "type_id": 44,
        "participant_id": 83,
        "data": {
          "value": 33
        },
        "location": "away",
        "type": {
          "id": 44,
          "name": "Dangerous Attacks",
          "code": "dangerous-attacks",
          "developer_name": "DANGEROUS_ATTACKS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123780661,
        "fixture_id": 19135354,
        "type_id": 78,
        "participant_id": 83,
        "data": {
          "value": 19
        },
        "location": "away",
        "type": {
          "id": 78,
          "name": "Tackles",
          "code": "tackles",
          "developer_name": "TACKLES",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123775371,
        "fixture_id": 19135354,
        "type_id": 60,
        "participant_id": 83,
        "data": {
          "value": 14
        },
        "location": "away",
        "type": {
          "id": 60,
          "name": "Throwins",
          "code": "throwins",
          "developer_name": "THROWINS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123778065,
        "fixture_id": 19135354,
        "type_id": 65,
        "participant_id": 3468,
        "data": {
          "value": 5
        },
        "location": "home",
        "type": {
          "id": 65,
          "name": "Successful Headers",
          "code": "successful-headers",
          "developer_name": "SUCCESSFUL_HEADERS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123777292,
        "fixture_id": 19135354,
        "type_id": 51,
        "participant_id": 3468,
        "data": {
          "value": 12
        },
        "location": "home",
        "type": {
          "id": 51,
          "name": "Offsides",
          "code": "offsides",
          "developer_name": "OFFSIDES",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775353,
        "fixture_id": 19135354,
        "type_id": 86,
        "participant_id": 3468,
        "data": {
          "value": 4
        },
        "location": "home",
        "type": {
          "id": 86,
          "name": "Shots On Target",
          "code": "shots-on-target",
          "developer_name": "SHOTS_ON_TARGET",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775367,
        "fixture_id": 19135354,
        "type_id": 53,
        "participant_id": 83,
        "data": {
          "value": 5
        },
        "location": "away",
        "type": {
          "id": 53,
          "name": "Goal Kicks",
          "code": "goals-kicks",
          "developer_name": "GOAL_KICKS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123777295,
        "fixture_id": 19135354,
        "type_id": 99,
        "participant_id": 3468,
        "data": {
          "value": 4
        },
        "location": "home",
        "type": {
          "id": 99,
          "name": "Accurate Crosses",
          "code": "accurate-crosses",
          "developer_name": "ACCURATE_CROSSES",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775585,
        "fixture_id": 19135354,
        "type_id": 80,
        "participant_id": 83,
        "data": {
          "value": 452
        },
        "location": "away",
        "type": {
          "id": 80,
          "name": "Passes",
          "code": "passes",
          "developer_name": "PASSES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775347,
        "fixture_id": 19135354,
        "type_id": 53,
        "participant_id": 3468,
        "data": {
          "value": 7
        },
        "location": "home",
        "type": {
          "id": 53,
          "name": "Goal Kicks",
          "code": "goals-kicks",
          "developer_name": "GOAL_KICKS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775372,
        "fixture_id": 19135354,
        "type_id": 83,
        "participant_id": 83,
        "data": {
          "value": 0
        },
        "location": "away",
        "type": {
          "id": 83,
          "name": "Redcards",
          "code": "redcards",
          "developer_name": "REDCARDS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123798774,
        "fixture_id": 19135354,
        "type_id": 109,
        "participant_id": 83,
        "data": {
          "value": 0
        },
        "location": "away",
        "type": {
          "id": 109,
          "name": "Successful Dribbles",
          "code": "successful-dribbles",
          "developer_name": "SUCCESSFUL_DRIBBLES",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775806,
        "fixture_id": 19135354,
        "type_id": 49,
        "participant_id": 3468,
        "data": {
          "value": 5
        },
        "location": "home",
        "type": {
          "id": 49,
          "name": "Shots Insidebox",
          "code": "shots-insidebox",
          "developer_name": "SHOTS_INSIDEBOX",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775809,
        "fixture_id": 19135354,
        "type_id": 64,
        "participant_id": 3468,
        "data": {
          "value": 0
        },
        "location": "home",
        "type": {
          "id": 64,
          "name": "Hit Woodwork",
          "code": "hit-woodwork",
          "developer_name": "HIT_WOODWORK",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775811,
        "fixture_id": 19135354,
        "type_id": 58,
        "participant_id": 83,
        "data": {
          "value": 1
        },
        "location": "away",
        "type": {
          "id": 58,
          "name": "Shots Blocked",
          "code": "shots-blocked",
          "developer_name": "SHOTS_BLOCKED",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123780660,
        "fixture_id": 19135354,
        "type_id": 78,
        "participant_id": 3468,
        "data": {
          "value": 20
        },
        "location": "home",
        "type": {
          "id": 78,
          "name": "Tackles",
          "code": "tackles",
          "developer_name": "TACKLES",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123783188,
        "fixture_id": 19135354,
        "type_id": 66,
        "participant_id": 3468,
        "data": {
          "value": 19
        },
        "location": "home",
        "type": {
          "id": 66,
          "name": "Successful Interceptions",
          "code": "successful-interceptions",
          "developer_name": "SUCCESSFUL_INTERCEPTIONS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123777349,
        "fixture_id": 19135354,
        "type_id": 99,
        "participant_id": 83,
        "data": {
          "value": 3
        },
        "location": "away",
        "type": {
          "id": 99,
          "name": "Accurate Crosses",
          "code": "accurate-crosses",
          "developer_name": "ACCURATE_CROSSES",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123798770,
        "fixture_id": 19135354,
        "type_id": 109,
        "participant_id": 3468,
        "data": {
          "value": 4
        },
        "location": "home",
        "type": {
          "id": 109,
          "name": "Successful Dribbles",
          "code": "successful-dribbles",
          "developer_name": "SUCCESSFUL_DRIBBLES",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123783189,
        "fixture_id": 19135354,
        "type_id": 66,
        "participant_id": 83,
        "data": {
          "value": 17
        },
        "location": "away",
        "type": {
          "id": 66,
          "name": "Successful Interceptions",
          "code": "successful-interceptions",
          "developer_name": "SUCCESSFUL_INTERCEPTIONS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775368,
        "fixture_id": 19135354,
        "type_id": 55,
        "participant_id": 83,
        "data": {
          "value": 28
        },
        "location": "away",
        "type": {
          "id": 55,
          "name": "Free Kicks",
          "code": "free-kicks",
          "developer_name": "FREE_KICKS",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123775812,
        "fixture_id": 19135354,
        "type_id": 49,
        "participant_id": 83,
        "data": {
          "value": 7
        },
        "location": "away",
        "type": {
          "id": 49,
          "name": "Shots Insidebox",
          "code": "shots-insidebox",
          "developer_name": "SHOTS_INSIDEBOX",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123775778,
        "fixture_id": 19135354,
        "type_id": 81,
        "participant_id": 3468,
        "data": {
          "value": 244
        },
        "location": "home",
        "type": {
          "id": 81,
          "name": "Successful Passes",
          "code": "successful-passes",
          "developer_name": "SUCCESSFUL_PASSES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123775813,
        "fixture_id": 19135354,
        "type_id": 50,
        "participant_id": 83,
        "data": {
          "value": 8
        },
        "location": "away",
        "type": {
          "id": 50,
          "name": "Shots Outsidebox",
          "code": "shots-outsidebox",
          "developer_name": "SHOTS_OUTSIDEBOX",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123778064,
        "fixture_id": 19135354,
        "type_id": 70,
        "participant_id": 3468,
        "data": {
          "value": 10
        },
        "location": "home",
        "type": {
          "id": 70,
          "name": "Headers",
          "code": "headers",
          "developer_name": "HEADERS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123778067,
        "fixture_id": 19135354,
        "type_id": 65,
        "participant_id": 83,
        "data": {
          "value": 6
        },
        "location": "away",
        "type": {
          "id": 65,
          "name": "Successful Headers",
          "code": "successful-headers",
          "developer_name": "SUCCESSFUL_HEADERS",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123779712,
        "fixture_id": 19135354,
        "type_id": 62,
        "participant_id": 3468,
        "data": {
          "value": 26
        },
        "location": "home",
        "type": {
          "id": 62,
          "name": "Long Passes",
          "code": "long-passes",
          "developer_name": "LONG_PASSES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123783451,
        "fixture_id": 19135354,
        "type_id": 77,
        "participant_id": 83,
        "data": {
          "value": 9
        },
        "location": "away",
        "type": {
          "id": 77,
          "name": "Challenges",
          "code": "challenges",
          "developer_name": "CHALLENGES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123783473,
        "fixture_id": 19135354,
        "type_id": 100,
        "participant_id": 83,
        "data": {
          "value": 9
        },
        "location": "away",
        "type": {
          "id": 100,
          "name": "Interceptions",
          "code": "interceptions",
          "developer_name": "INTERCEPTIONS",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123794187,
        "fixture_id": 19135354,
        "type_id": 57,
        "participant_id": 83,
        "data": {
          "value": 4
        },
        "location": "away",
        "type": {
          "id": 57,
          "name": "Saves",
          "code": "saves",
          "developer_name": "SAVES",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123816039,
        "fixture_id": 19135354,
        "type_id": 79,
        "participant_id": 83,
        "data": {
          "value": 4
        },
        "location": "away",
        "type": {
          "id": 79,
          "name": "Assists",
          "code": "assists",
          "developer_name": "ASSISTS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123794186,
        "fixture_id": 19135354,
        "type_id": 57,
        "participant_id": 3468,
        "data": {
          "value": 3
        },
        "location": "home",
        "type": {
          "id": 57,
          "name": "Saves",
          "code": "saves",
          "developer_name": "SAVES",
          "model_type": "statistic",
          "stat_group": "defensive"
        }
      },
      {
        "id": 123794188,
        "fixture_id": 19135354,
        "type_id": 117,
        "participant_id": 3468,
        "data": {
          "value": 6
        },
        "location": "home",
        "type": {
          "id": 117,
          "name": "Key Passes",
          "code": "key-passes",
          "developer_name": "KEY_PASSES",
          "model_type": "statistic",
          "stat_group": "overall"
        }
      },
      {
        "id": 123816012,
        "fixture_id": 19135354,
        "type_id": 79,
        "participant_id": 3468,
        "data": {
          "value": 1
        },
        "location": "home",
        "type": {
          "id": 79,
          "name": "Assists",
          "code": "assists",
          "developer_name": "ASSISTS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123798771,
        "fixture_id": 19135354,
        "type_id": 108,
        "participant_id": 3468,
        "data": {
          "value": 13
        },
        "location": "home",
        "type": {
          "id": 108,
          "name": "Dribble Attempts",
          "code": "dribble-attempts",
          "developer_name": "DRIBBLED_ATTEMPTS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      },
      {
        "id": 123798773,
        "fixture_id": 19135354,
        "type_id": 108,
        "participant_id": 83,
        "data": {
          "value": 8
        },
        "location": "away",
        "type": {
          "id": 108,
          "name": "Dribble Attempts",
          "code": "dribble-attempts",
          "developer_name": "DRIBBLED_ATTEMPTS",
          "model_type": "statistic",
          "stat_group": "offensive"
        }
      }
    ]
  },
  "subscription": [
    {
      "meta": {
        "trial_ends_at": "2024-10-16 14:50:45",
        "ends_at": null,
        "current_timestamp": 1734350922
      },
      "plans": [
        {
          "plan": "Enterprise plan (loyal)",
          "sport": "Football",
          "category": "Advanced"
        },
        {
          "plan": "Enterprise Plan",
          "sport": "Cricket",
          "category": "Standard"
        },
        {
          "plan": "Formula One",
          "sport": "Formula One",
          "category": "Standard"
        }
      ],
      "add_ons": [
        {
          "add_on": "All-in News API",
          "sport": "Football",
          "category": "News"
        },
        {
          "add_on": "pressure index add-on",
          "sport": "Football",
          "category": "Default"
        },
        {
          "add_on": "Enterprise Plan Predictions",
          "sport": "Football",
          "category": "Predictions"
        },
        {
          "add_on": "xG Advanced",
          "sport": "Football",
          "category": "Expected"
        }
      ],
      "widgets": [
        {
          "widget": "Sportmonks Widgets",
          "sport": "Football"
        }
      ]
    }
  ],
  "rate_limit": {
    "resets_in_seconds": 3357,
    "remaining": 2996,
    "requested_entity": "Fixture"
  },
  "timezone": "UTC"
}

The response from 4.1 returns a lot of statistics; however, what can we do if we are interested in just a specific type of detail, such as shots on target or successful passes?

We will handle this type of scenario in the next section.

Chapter 4.3 Applying a Filter for Ball Possession.

Here is where another powerful tool built into our Football API named ‘filters’ comes in handy.

While you can read all about filtering here. In this exercise, we will apply a filter to narrow the response down to only ball possession.

From the response in 4.2, we can easily find the type_id for ball possession, which is 45. Using this piece of information, we will modify our code to filter the response.

Here is the URL of interest https://api.sportmonks.com/v3/football/fixtures/19135354?api_token=API_Token&include=statistics.type&filters=fixtureStatisticTypes:45

using HTTP 

using JSON3 

# Define the API endpoint and token 

api_token = "API Token"  # Your valid API token 

url = "https://api.sportmonks.com/v3/football/fixtures/19135354" 

# Construct the query string with all parameters 

query_params = Dict( 

    "api_token" => api_token, 

    "include" => "statistics.type", 

    "filters" => "fixtureStatisticTypes:45" 

) 

query_string = "?" * join(["$k=$v" for (k, v) in query_params], "&") 

full_url = url * query_string 

 

# Try-catch block for error handling 

try 

    response = HTTP.get(full_url) 

     

    # Check the response status 

    if response.status == 200 

        # Parse JSON response 

        data = JSON3.read(String(response.body)) 

        println("Data: ", data) 

    else 

        println("Request failed with status: ", response.status, " - ", String(response.body)) 

    end 

catch e 

    # Handle any errors 

    println("An error occurred: ", e) 

end 

Data: {
           "data": {
                                         "id": 19135354,
                                   "sport_id": 1,
                                  "league_id": 564,
                                  "season_id": 23621,
                                   "stage_id": 77471332,
                                   "group_id": nothing,
                               "aggregate_id": nothing,
                                   "round_id": 339304,
                                   "state_id": 5,
                                   "venue_id": 2020,
                                       "name": "Real Madrid vs FC Barcelona",
                                "starting_at": "2024-10-26 19:00:00",
                                "result_info": "FC Barcelona won after full-time.",
                                        "leg": "1/1",
                                    "details": nothing,
                                     "length": 90,
                                "placeholder": false,
                                   "has_odds": true,
                           "has_premium_odds": true,
                      "starting_at_timestamp": 1729969200,
                                 "statistics": [
                                      
           {
                                      
                          "id": 123775810,
                                      
                  "fixture_id": 19135354,
                                      
                     "type_id": 45,   
                                      
              "participant_id": 83,   
                                      
                        "data": {     
                                      
                                   "value": 58
                                      
                                },    
                                      
                    "location": "away",
                                      
                        "type": {     
                                      
                                      
         "id": 45,
                                      
                                      
       "name": "Ball Possession %",   
                                      
                                      
       "code": "ball-possession",     
                                      
                                   "developer_name": "BALL_POSSESSION",
                                      
                                      
 "model_type": "statistic",
                                      
                                      
 "stat_group": "overall"
                                      
                                }     
                                      
           },
                                      
           {
                                      
                          "id": 123775779,
                                      
                  "fixture_id": 19135354,
                                      
                     "type_id": 45,   
                                      
              "participant_id": 3468, 
                                      
                        "data": {     
                                      
                                   "value": 42
                                      
                                },    
                                      
                    "location": "home",
                                      
                        "type": {     
                                      
                                      
         "id": 45,
                                      
                                      
       "name": "Ball Possession %",
                                      
                                      
       "code": "ball-possession",
                                      
                                   "developer_name": "BALL_POSSESSION",     
                                      
                                      
 "model_type": "statistic",
                                      
                                      
 "stat_group": "overall"
                                      
                                }     
                                      
           }
                                      
         ]
                   },
   "subscription": [
                     {
                           "meta": {
                                      
    "trial_ends_at": "2024-10-16 14:50:45",
                                      
          "ends_at": nothing,
                                      
"current_timestamp": 1734358126       
                                   }, 
                          "plans": [  
                                     {
                                      
      "plan": "Enterprise plan (loyal)",
                                      
     "sport": "Football",
                                      
  "category": "Advanced"
                                     },
                                     {
                                      
      "plan": "Enterprise Plan",      
                                      
     "sport": "Cricket",
                                      
  "category": "Standard"
                                     },
                                     {
                                      
      "plan": "Formula One",
                                      
     "sport": "Formula One",
                                      
  "category": "Standard"
                                     }
                                   ], 
                        "add_ons": [  
                                     {
                                      
    "add_on": "All-in News API",
                                      
     "sport": "Football",
                                      
  "category": "News"
                                     },
                                     {
                                      
    "add_on": "pressure index add-on",
                                      
     "sport": "Football",
                                      
  "category": "Default"
                                     },
                                     {
                                      
    "add_on": "Enterprise Plan Predictions",
                                      
     "sport": "Football",
                                      
  "category": "Predictions"
                                     },
                                     {
                                      
    "add_on": "xG Advanced",
                                      
     "sport": "Football",
                                      
  "category": "Expected"
                                     }
                                   ], 
                        "widgets": [
                                     {
                                      
  "widget": "Sportmonks Widgets",
                                      
   "sport": "Football"
                                     }
                                   ]  
                     }
                   ],
     "rate_limit": {
                      "resets_in_seconds": 1638,
                              "remaining": 2993,
                       "requested_entity": "Fixture"
                   },
       "timezone": "UTC"
}


As you can see from the result which has been filtered to show only the ball possession, the home side, Real Madrid had 42% of the ball, while the away side, Barcelona, had 58% of the ball.

FAQ

How can I test the Sportmonks API for FREE?
You have two options:
  1. Create an account on My Sportmonks and get immediate access to our free plan.
  2. Subscribe to one of our paid plans and receive a one-time-only 14-day free trial.
How do I build and filter API requests?
Use the base URL and include necessary data points like scores, events, and participants. Apply filters to refine the data to match specific criteria. Here’s an example of how to incorporate the filter into your request: https://api.sportmonks.com/v3/football/livescores/inplay?api_token=YOUR_TOKEN&include=events&filters=eventTypes:14,19,20,21 By utilising filtering capabilities, we can tailor the data retrieved from the API to match the specific needs and preferences of our livescore website. For further details on filtering techniques, refer to our dedicated filter tutorial for additional guidance.
How does the API work?
We have built a well-structured, flexible, and fast JSON API. Our API makes it easy to customize your JSON responses. Our API's flexibility demonstrates itself by allowing its users to build their own responses in the form of adding include parameters to their requests. This means you can request the data you need and leave out the data you don't need. Filtering and Sorting is another widely used and loved characteristic of our API. It means you can request the data the way you want it to, by adding the proper filtering and sorting commands. Please check our documentation pages for more information.
How many API calls do I get?
By default, you will have access to 2000 API calls per endpoint per hour. If you feel this is not enough, you can upgrade this amount when selecting your plan.
Is there a limit to the number of API requests I can make?
We offers different subscription plans with varying levels of access and usage limits. While the Free plan has certain restrictions on the number of API requests allowed per day, higher-tier plans offer increased usage (3,000 API calls per entity per hour) allowances and additional features. If you require more API requests than your current plan allows, you can consider upgrading to a higher-tier plan or contacting support for customised solutions tailored to your needs.

Written by David Jaja

David Jaja is a technical content manager at Sportmonks, where he makes complex football data easier to understand for developers and businesses. With a background in frontend development and technical writing, he helps bridge the gap between technology and sports data. Through clear, insightful content, he ensures Sportmonks' APIs are accessible and easy to use, empowering developers to build standout football applications

Unlock your full potential!

Unlock the full potential of your football application with Sportmonks’ Football API.

Our API provides everything you need to take your project to the next level.You too can build a mind blowing app. Don’t miss out! Sign up now and kickstart your journey to success!

Try for free