https://github.com/technicalguru/sportdata-api-client
Java client for sportdataapi.com
https://github.com/technicalguru/sportdata-api-client
football-api football-data footballdata java rest-api soccer soccer-data soccer-data-api soccer-matches sportdata sports-data
Last synced: 2 months ago
JSON representation
Java client for sportdataapi.com
- Host: GitHub
- URL: https://github.com/technicalguru/sportdata-api-client
- Owner: technicalguru
- License: other
- Created: 2020-10-23T18:46:34.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-15T08:24:33.000Z (over 3 years ago)
- Last Synced: 2025-02-08T06:30:55.151Z (4 months ago)
- Topics: football-api, football-data, footballdata, java, rest-api, soccer, soccer-data, soccer-data-api, soccer-matches, sportdata, sports-data
- Language: Java
- Homepage:
- Size: 318 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# sportdata-api-client (Project stopped)
Java client for requesting data from [sportdataapi.com](https://sportdataapi.com).## Synopsis
This Java client provides access to [sportdataapi.com](https://sportdataapi.com)'s REST API (soccer only). It returns data as
respective Java objects and encapsulates the REST API boilerplate of handling encoding/decoding JSON or correct
URL, HTTP headers and query parameter syntax.**Attention!** A valid subscription is required to use this client. Anonymous clients will not work.
## Status and Roadmap
The project is stuck in Beta phase and was aborted (due to missing production usage). Interested parties may takeover this project. Please contact me## Features
* Implementation of all soccer REST endpoints
* Handling of HTTP 404 return codes and returning empty lists or `null` values.
* Automatic decoding of values into corresponding Java objects wherever possible
* **Not** thread-safe. You will need a `SdaClient` per thread in case this is your requirement.## Maven Coordinates
```
eu.ralph-schuster
sportdata-api-client
0.9.6```
## API Reference
API Javadoc for all versions is available via [javadoc.io](https://www.javadoc.io/doc/eu.ralph-schuster/sportdata-api-client).
## License
*sportdata-api-client* is free software: you can redistribute it and/or modify it under the terms of version 3 of the [GNU
Lesser General Public License](LICENSE.md) as published by the Free Software Foundation.*sportdata-api-client* is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.You should have received a copy of the GNU Lesser General Public License along with *sportdata-api-client*. If not, see
[https://www.gnu.org/licenses/lgpl-3.0.html](https://www.gnu.org/licenses/lgpl-3.0.html).Summary:
1. You are free to use all this code in any private or commercial project.
2. You must distribute license and author information along with your project.
3. You are not required to publish your own source code.## Usage Example
First, create your client instance via the `SdaClientFactory` using your API key:```
String myApiKey = '00000000-0000-0000-0000-000000000000';
SdaClient client = SdaClientFactory.newClient(myApiKey);
```Next is to retrieve the subclient for the API you wish to use and make your request, e.g.:
```
LeaguesClient leaguesClient = client.soccer().leagues();
List germanLeagues = leaguesClient.list(48);
```Now, you could try to find the current season of each league:
```
SeasonsClient seasonsClient = client.soccer.seasons();
for (League league : germanLeagues) {
List seasons = seasonsClient.list(league.getId());
for (Season season : seasons) {
if (season.isCurrent()) {
...
}
}
}
```Once you are finished, you will need to close the client accordingly:
```
client.close();
```PS: It is a good pattern to always wrap the `get()` and `list()` calls in `try {} catch () {}` blocks
as the methods can still throw ``ForbiddenException`` or other exceptions that result from errors returned by the server.## Developer Notes
Please be aware that JUnit tests require a valid API key from sportdataapi.com with the correct leagues subscribed to. Provide
the key either by setting environment variable `SDA_API_TOKEN` or creating a file `my-apikey.txt` that is available
in any of the classpath's folders, e.g. in `src/test/resources`. Be careful not to submit this file in any of your
code repositories.## Contributions
Report a bug, request an enhancement or pull request at the [GitHub Issue Tracker](https://github.com/technicalguru/sportdata-api-client/issues).
Make sure you have checked out the [Contribution Guideline](CONTRIBUTING.md)