Making a request

This reference page explains how you should make request calls to our APIs so they work.

Endpoint structure

Knowing the url structure of our api endpoints will help you when forming your requests. In this section, we start with the first step of telling you about the structure of the endpoint. If we look at the example bellow we can define all the distinct parts of the url endpoint. 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:

  1. http://livescore-api.com/api-client - is path to the root of our api endpoints.
  2. /scores - is the module that we are using in the examples. Following the MVC model we have models which contain controllers, and the they are the one that provide all the functionality.
  3. /live - is the controller in the module that we are evoking. A single model can have many controllers.
  4. .json - this is the format of the response that we would like to get. We support JSON, CSV, and XML as response formats. You can read more about them on our api response reference page.
  5. Everything after the question mark (?) is get parameters here you provide your api key, api secret, or CSV delimiter.

Providing key and secret pair

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. demo_key is the api key in this example and demo_secret is the api secret. In order to provide them to the API endpoints you have to add them in the URL that you call as GET variables after the question mark (?). The example url is structured in the correct way. The order in which you provide them does not make any difference in the way way handle your requests.

Choosing response format

This sections explains how to tell us what format of response you desire. To read about the structure of the our formats or the different types available you can visit our special api response reference page. In general, you provide the response format that you would like by providing the file extension of the format. For example, for JSON you will feed us with json. The format is provided after the name of the controller that should handle your request followed by a dot. In the example above, the controller is live followed by a . followed by the jsonformat request. To turn this into XML format we replace json with xml resulting in live.xml. The process is similar with CSV response formats live.csv.

HTTP GET

All of our livescore api endpoints are server using the HTTP protocol and only with the HTTP method GET. Every other request with different HTTP method will result an error specifying that this method is not supported. You can find more on our standard errors in our specially dedicated reference page.