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.
- PHP version >=7.2
- ext-json required
Use Composer to install the latest version with command:
$ composer require statscore/apiclient
or add our package to your composer.json
file.
{
"require": {
"statscore/apiclient": "^1"
}
}
Access to the API is based on the oAuth 2.0 authorization method. This means access is given using a unique token without any IP's restriction.
The client is authenticated using a GET request including query string parameters: client_id and secret_key. These parameters are assigned to you by our sales department. On confirmation of the client_id/secret_key combination, the special oAuth token is then returned. Maximum period of time the token is valid is 24 hours from the time it was generated. This token should be sent with all subsequent requests.
<?php
use Statscore\Client;
use Statscore\Model\Response\Authorization\AuthorizationDTO;
$clientId = 1;
$statscore = new Client($clientId, 'yoursecretkey');
/** @var AuthorizationDTO $authDTO */
$authDTO = $statscore->authorize();
/** Get your token, save it and use in future requests */
$statscore->setToken($authDTO->getToken());
<?php
use Statscore\Model\Response\BookedEvent\BookedEventDTO;
use Statscore\Model\Response\ResponseDTO;
$clientId = 1;
$productName = 'livescorepro';
/** @var ResponseDTO $response */
$response = $statscore->bookedEvents->getAll($clientId, $productName);
/** @var BookedEventDTO[] $bookedEvents */
$bookedEvents = $response->getData();
<?php
use Statscore\Model\Response\BookedEvent\BookedEventDTO;
use Statscore\Model\Response\ResponseDTO;
$clientId = 1;
$productName = 'livescorepro';
$eventId = 1232131;
/** @var ResponseDTO $response */
$response = $statscore->bookedEvents->create($clientId, $productName, $eventId);
/** @var BookedEventDTO[] $bookedEvents */
$bookedEvents = $response->getData();
<?php
use Statscore\Model\Response\ResponseDTO;
$clientId = 1;
$productName = 'livescorepro';
$eventId = 1232131;
/** @var ResponseDTO $response */
$response = $statscore->bookedEvents->delete($clientId, $productName, $eventId);
Our support team, based in Katowice, exists for one purpose: to serve and delight STATSCORE customers.
Have a question? Our team will help you find answers 24 hours a day, 365 days a year. Please send us an email at tech-support@statscore.com
Issues are tracked on GitHub