Competitions are the current way of working with leagues and cups. Our old leagues are now deprecated. In this guide, we show how to get the full list of competitions that our soccer API provides.
Before we start explaining how to work with competitions, we need to clarify some terms used in our soccer API:
In order, to get the list of all competitions that our soccer API provides and supports you need to call the url bellow. In this example, we have used the demo api key and secret pair. If you login in, you will see all examples with your own api key and api secret.
This soccer API endpoint supports several parameters that help you filter the football competitions based on countries or federations. By countries, we mean a sovereign country that can be found on the map (e.g. Russia, Italy, South Africa), and by federation we mean international football association (like: FIFA, CONMEBOL, CAF, AFC). You can read more on getting to know the countries in the getting countries list documentation page. To find out how federations work in the context of our soccer API refer to the federations specific page.
Name | Type | Required | Example | Description |
---|---|---|---|---|
country_id | number | optional | 1 | Will show the competitions from that specific country only |
federation_id | number | optional | 13 | Will show the competitions from that specific federation only |
NOTE: If you provide both a country_id
and a federation_id
the country will take precedence and you will see only football competitions from that country!
If you call the URL in the box above, our soccer API will return a response similar to what is show in this section. First, in the table we explain what fields are there, and the follows a JSON example. However, the API works with XML too.
Name | Type | Example | Description |
---|---|---|---|
id | number | 5 | the id of the competition which you can use as filters in other sequential requests. |
name | string | Serie A | the name of the competition. |
countries | list | List with all the countries to which the competition belongs | |
federations | list | List with all the federations to which the competition belongs |
{
"success": true,
"data": {
"competition": [
{
"id": "339",
"name": "1. Liga Promotion",
"countries": [
{
"id": "9",
"name": "Switzerland"
}
],
"federations": []
},
{
"id": "125",
"name": "1st Deild",
"countries": [
{
"id": "33",
"name": "Iceland"
}
],
"federations": []
},
{
"id": "244",
"name": "Champions League",
"countries": [],
"federations": [
{
"id": "2",
"name": "UEFA"
}
]
}
]
}
}
The following examples show you how to use this endpoint in various programming languages. In this example, we have used the demo api key and secret pair. If you login in, you will see all examples with your own api key and api secret.
cUrl
curl -XGET https://livescore-api.com/api-client/competitions/list.json?key=demo_key\\&secret=demo_secret
PHPfile_get_contents('https://livescore-api.com/api-client/competitions/list.json?key=demo_key\&secret=demo_secret');
Pythonimport urllib2
req = urllib2.Request('https://livescore-api.com/api-client/competitions/list.json?key=demo_key\&secret=demo_secret')
response = urllib2.urlopen(req)
print response.read()
To get the list of competitions for a certain country, you have to provide the id of the country as a get query parameter in the api endpoint URL. The parameter is country_id
. In the example bellow we show you how to get all the competitions for Germany. To find our more about the countries and their ids visit the countries list documentation page.
cUrl
curl -XGET https://livescore-api.com/api-client/competitions/scores.json?key=demo_key\&secret=demo_secret\&country_id=2
PHPfile_get_contents('https://livescore-api.com/api-client/competitions/scores.json?key=demo_key&secret=demo_secret&country_id=2');
Pythonimport urllib2
req = urllib2.Request('https://livescore-api.com/api-client/competitions/scores.json?key=demo_key&secret=demo_secret&country_id=2')
response = urllib2.urlopen(req)
print response.read()
To get the list of competitions for a certain football federation, you have to provide the id of the federation as an http GET query parameter in the same api endpoint URL. The parameter is called federation_id
. In the example bellow we show you how to get all the competitions for UEFA. You can find our more about the federations and their ids in the federations list documentation page.
cUrl
curl -XGET https://livescore-api.com/api-client/competitions/scores.json?key=demo_key\&secret=demo_secret\&federation_id=2
PHPfile_get_contents('https://livescore-api.com/api-client/competitions/scores.json?key=demo_key&secret=demo_secret&federation_id=2');
Pythonimport urllib2
req = urllib2.Request('https://livescore-api.com/api-client/competitions/scores.json?key=demo_key&secret=demo_secret&federation_id=2')
response = urllib2.urlopen(req)
print response.read()