Getting list of leagues

In this reference we will show you how you can the list of all leagues, or leagues only for a certain country, that our livescore api data support feed supports and how to interpret it.


Endpoint

In order to get the list of all leagues that our livescore data feed supports the only thing you need to do is the call the url bellow. It is possible for you to get the list of all leagues or only the leagues for a specific country. In the first part of the reference we write about the full list and in the second part we talk about the "by country" list. 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

GET:

Response

The response contains the following information, for every league element in the list. The same rules apply for the JSON objects and the CSV columns.

  • id - the id of the country which you can use in sub sequential requests.
  • name - the name of the country.
  • country_id - this is the id of the country to which the league belongs. To find out more about the countries API endpoint you can read the countries reference page.
  • scores - this is an API link to the list of all livescores that we have for this league right now.
{
    "success": true,
    "data": {
        "league": [
            {
                "id": "36",
                "name": "1st Division",
                "country_id": "23",
                "scores": "http:\/\/livescore-api.com/api-client\/scores\/live.json?key=demo_key&secret=demo_secret&league=36"
            },
            {
                "id": "298",
                "name": "1st Division",
                "country_id": "75",
                "scores": "http:\/\/livescore-api.com/api-client\/scores\/live.json?key=demo_key&secret=demo_secret&league=298"
            },
            {
                "id": "53",
                "name": "1st Division",
                "country_id": "12",
                "scores": "http:\/\/livescore-api.com/api-client\/scores\/live.json?key=demo_key&secret=demo_secret&league=53"
            }
        ]
    }
}

Examples

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 http://livescore-api.com/api-client/leagues/list.json?key=demo_key\&secret=demo_secret
PHP <?php
file_get_contents('http://livescore-api.com/api-client/leagues/list.json?key=demo_key&secret=demo_secret')
?>

Python import urllib2
req = urllib2.Request('http://livescore-api.com/api-client/leagues/list.json?key=demo_key&secret=demo_secret')
response = urllib2.urlopen(req)
print response.read()

Leagues by country

In order to get the list of leagues for a specific country all you need to do is to provide the id of the country as a GET parameter in the URL. If you want to know more about how to get the id of the country you can read our page about the countries API endpoint. In this After you add the country in the url you will receive the list with the leagues in that country that our livescore api data feed supports. Let's take an example with England. After going through the countries list, we have found out that England has the ID of 19. In order to get the leagues for England we provide the id as a country parameter as in the example 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 http://livescore-api.com/api-client/leagues/list.json?key=demo_key&secret=demo_secret&country=19

Examples

The following examples show you how to use this endpoint with the England country id 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 http://livescore-api.com/api-client/leagues/list.json?key=demo_key\&secret=demo_secret\&country=19
PHP <?php
file_get_contents('http://livescore-api.com/api-client/leagues/list.json?key=demo_key&secret=demo_secret&country=19')
?>

Python import urllib2
req = urllib2.Request('http://livescore-api.com/api-client/leagues/list.json?key=demo_key&secret=demo_secret&country=19')
response = urllib2.urlopen(req)
print response.read()

Copied
Feedback