Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The API service is based on the REST architecture and supports a number of resources accessed with HTTP protocol. The client should send a HTTP GET request and in return will receive a return list document in JSON or XML format. The default response format is JSON. You can change the default response format to XML by adding ".xml" extension after the <resource_name> in the requested URL (please see below). The encoding used in our XML is UTF-8. API support multiple simultaneous requests from authenticated customers. 
We have standardized the have standardised the output for ALL sports, so we offer same format and data structure. However for each sports there are different event details, incidents and statistics that are explained in more detail in the Sports data structure section.

Please note that new event details, incidents and statistics could be added in the future. Whenever new features are added to the API you will find a description in the API changelogchange-log.

Authentication

Access to the API is based on the oAuth 2.0 authorization 0 authorization method. This means access is given using a unique token without any IP's restriction.

...

All responses to a successful request (http status code = 200) have the same structure:

...

<?xml version="1.0" encoding="UTF-8"?>
<api version="2.0" timestamp="1425992728">
<method name="events.index" details="<link for method description>" total_items="10" next_page="<link or empty value>"
previous_page="<link or empty value>">
<parameter name="id" value="7"/>
<parameter name="lang" value="en"/>
</method>
 
<data>
      <----DATA---->
</data>
 
</api>

Element <api>

Code Block
languagetext
"api": {
	"ver": "2.146.0",
	"timestamp": 1575991564,
	"method": {
		"parameters": {
			"client_id": 1,
			"events_details": "yes"
		},
		"name": "events.index",
		"details": "events.index",
		"total_items": 511,
		"previous_page": "",
		"next_page": "https://api.statscore.com/v2/events?token=YOUR_TOKEN&client_id=1&page=2"
	},
	"data": {
	...
	}
}


Element "api" is heading element for each response. The <api> The "api" element includes attributes:

  • version - means the version in which the data is processed. You should always use the proper version in your code. You can switch the version in the URL request. For more information about versions please see our API changelog.

  • timestamp - UNIX TIMESTAMP value from API server. This value is generated on every request.

The <data> "data" element contains all requested information.

...

For unsuccessful requests the response contains <error> element:

...

Code Block
languagetext
"api": {
	"ver": "2.146.0",
	"timestamp": 1575991564,
	"method": {
		"parameters": {
			"client_id": 1,
			"events_details": "yes"
		},
		"name": "events.index",
		"details": "events.index",
		"total_items": 511,
		"previous_page": "",
		"next_page": "https://api.statscore.com/v2/events?token=YOUR_TOKEN&client_id=1&page=2"
	},
	"error": {
		"message": "Invalid credentials. Either the username, password or token you provided is incorrect",
		"status": 401,
		"internal_code": 2
	}
}


Here is a general explanation about possible error codes:

...


For example: Suppose you refreshed all your data and got the following header in the response XML:

<api version="2.0" timestamp="1425992728"> <method name=
Code Block
languagexml
languagexml
"api": {
	"ver": "2.146.0",
	"timestamp": 1425992728,
	"method": {
		"parameters": {
			"client_id": 1,
			"events_details": "yes"
		},
		"name": "events.index",
		"details="<link for method description>" total_items="10" next_page="<link or empty value>" previous_page="<link or empty value>">
<parameter name="id" value="7"/>
<parameter name="lang" value="en"/>
</method>
<data>
      <!------DATA------!>
</data>: "events.index",
		"total_items": 511,
		"previous_page": "",
		"next_page": "https://api.statscore.com/v2/events?token=YOUR_TOKEN&client_id=1&page=2"
	},
	"data": {
	...
	}
}

The next request should be as follows:

...