statscore / apiclient
STATSCORE Official SportsAPI Client
Requires
- php: >=7.3
- ext-json: *
- guzzlehttp/guzzle: ^6.5
- symfony/http-foundation: ^5.0
- symfony/property-access: ^5.0
- symfony/property-info: ^5.0
- symfony/serializer: ^5.0
Requires (Dev)
- mockery/mockery: ^1.3
- phpunit/phpunit: ^9.1
- symfony/var-dumper: ^5.0
This package is auto-updated.
Last update: 2024-11-19 22:40:18 UTC
README
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.
Table of Contents
Installation
Prerequisites
- PHP version >=7.2
- ext-json required
Documentation
Hot to install package
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" } }
Examples
Authentication
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());
Booked Events
Get all
<?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();
Create
<?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();
Delete
<?php use Statscore\Model\Response\ResponseDTO; $clientId = 1; $productName = 'livescorepro'; $eventId = 1232131; /** @var ResponseDTO $response */ $response = $statscore->bookedEvents->delete($clientId, $productName, $eventId);
Troubleshooting
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