Here we explain how to request data, in order to create popular sports applications, such as livescore pages, odds match pages, etc, but also how to use the more advanced endpoints e.g. prediction api
Welcome to our how-to guide about building API requests. We briefly touched upon sending requests and receiving responses on our getting started page. This guide assumes you are already familiar with most of our various features that have been discussed in the tutorials and that you have your own personal API token ready.
We'll cover how to build correct API requests with our Football API 2.0
In this guide, we’ll be covering how to build API requests with our . The example API request will be focused on getting all the football matches on a certain date by using the . Fixtures is the terminology used for matches.
We’ll be working with a free plan, so we only have access to the Danish Superliga (id: 271) and the Scottish Premiership (id: 501).
The first thing we need to have is our base URL and our API token.
Next, we need to add an endpoint to the base URL. As stated earlier, for this example we want to get all of the fixtures on a certain date. The endpoint for that is called . This will transform our URL into:
The date has to be in the format of YYYY-MM-DD. In this example, we’ll take the date of 2020-09-26.
The football API 2.0 will return a ton of information, but the main takeaway is that there are various ids about the fixture, league, season, stage, etc. Other than that, there is also score, time, coaches and standings. Below is a snippet of the output.
We might be interested in the teams that will be playing against each other. We can then add the following part to our request: &includes=localTeam,visitorTeam
. Now our URL will be:
Now we have more information about the local and visitor teams. The local team is called Hamilton Academical, with team id 338 and the visitor team is called Dundee United with team id 282.
Now, we can see that the coach of the visitor team is called Micky Mellon with coach id 896498.
See how flexible the API requests and responses can be? You request exactly what you need and the API will return exactly that.
We recommend you submit your requests with Postman since we have already prepared the request for you there! Hit the button below to import our Football API collection.
You can check out our if you want more detailed information.
This guide would be pretty short if we were to end here. That’s why we’ll now be our API request with includes. Here is the URL we used previously again.
You can check out our if you want more detailed information.
We can go even further beyond, by using . Let’s say we would like to know more about the coach of the visitor team. We simply add.coach
to visitorTeam. The URL then becomes this:
You can check out our if you want more detailed information.