Skip to content

Latest commit

 

History

History
1931 lines (1300 loc) · 34.1 KB

03-supported-endpoints.md

File metadata and controls

1931 lines (1300 loc) · 34.1 KB

Supported Endpoints

Responses

All successful responses will return an <Entity>Item or an <Entity>Collection.

One of the differences between an <Entity>Item and an <Entity>Collection is that the <Entity>Item getData() method will return a single Entity object, while the <Entity>Collection getData() method will return an array of Entity objects.

For example, when requesting a fixture by id, the response will be a FixtureItem object and the getData() method will return a Fixture object. The same way that when requesting all fixtures, the response will be a FixtureCollection object and the getData() method will return an array of Fixture objects. Check the responses entities for more information.

// returns a FixtureItem object
$response = $api->fixtures()->getById(1);
// returns a Fixture object
$fixture = $response->getData();
echo $fixture->getName();

// returns a FixtureCollection object
$response = $api->fixtures()->getAll();
// returns an array of Fixture objects
$fixtures = $response->getData();
foreach ($fixtures as $fixture) {
    echo $fixture->getName();
}

Pagination

<Entity>Collection responses that contain pagination data (not all of them have) will be accessible through the getPagination() method:

$response = $api->fixtures()->getAll();

echo $response->getPagination()->getCount();
echo $response->getPagination()->getPerPage();
echo $response->getPagination()->getCurrentPage();
echo $response->getPagination()->getNextPage();
echo $response->getPagination()->hasMore();

Rate Limit

All responses include the getRateLimit() method with the current quota usage. Check the official documentation for more information.

$response = $api->fixtures()->getById(1);

echo $response->getRateLimit()->getRemainingNumRequests();
echo $response->getRateLimit()->getSecondsToReset();
echo $response->getRateLimit()->getRequestedEntity();

Timezone

All responses include the getTimezone() method with the timezone of the given data. By default, all responses will be in the UTC timezone.

To request data in a different timezone for all requests, check the configuration section. For a single endpoint, check the withTimezone section.

$response = $api->fixtures()->getById(1);

echo $response->getTimezone(); // UTC

Football Endpoints

Coaches

getAll

getAll(): CoachCollection

Get all coaches:

$response = $api->coaches()->getAll();

getById

getById(int $id): CoachItem

Get coach by id:

$response = $api->coaches()->getById(1);

getAllByCountryId

getAllByCountryId(int $countryId): CoachCollection

Get all coaches by country id:

$response = $api->coaches()->getAllByCountryId(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): CoachCollection

Get all coaches by search query:

$response = $api->coaches()->getAllBySearchQuery('coach');

getAllLastUpdated

getAllLastUpdated(): CoachCollection

Get all coaches that received updates in the last couple of hours:

$response = $api->coaches()->getAllLastUpdated();

Commentaries

getAll

getAll(): CommentaryCollection

Get all commentaries:

$response = $api->commentaries()->getAll();

getAllByFixtureId

getAllByFixtureId(int $fixtureId): CommentaryCollection

Get all commentaries by fixture id:

$response = $api->commentaries()->getAllByFixtureId(1);

Fixtures

getAll

getAll(): FixtureCollection

Get all fixtures:

$response = $api->fixtures()->getAll();

getById

getById(int $id): FixtureItem

Get fixture by id:

$response = $api->fixtures()->getById(1);

getAllByMultipleIds

getAllByMultipleIds(array $ids): FixtureCollection

Get all fixtures by multiple ids:

$response = $api->fixtures()->getAllByMultipleIds([1, 2, 3]);

getAllByDate

getAllByDate(\DateTimeInterface $date): FixtureCollection

Get all fixtures by date:

$response = $api->fixtures()->getAllByDate(new DateTime('today'));

getAllByDateRange

getAllByDateRange(\DateTimeInterface $startDate, \DateTimeInterface $endDate): FixtureCollection

Get all fixtures by date range:

$response = $api->fixtures()->getAllByDateRange(new DateTime('today'), new DateTime('+7 days'));

getAllByTeamIdAndDateRange

getAllByTeamIdAndDateRange(int $teamId, \DateTimeInterface $startDate, \DateTimeInterface $endDate): FixtureCollection

Get all fixtures by team id and date range:

$response = $api->fixtures()->getAllByTeamIdAndDateRange(1, new DateTime('today'), new DateTime('+7 days'));

getAllByHeadToHead

getAllByHeadToHead(int $teamId1, int $teamId2): FixtureCollection

Get all fixtures between two teams:

$response = $api->fixtures()->getAllByHeadToHead(1, 2);

getAllBySearchQuery

getAllBySearchQuery(string $query): FixtureCollection

Get all fixtures by search query:

$response = $api->fixtures()->getAllBySearchQuery('team');

getAllUpcomingByMarketId

getAllUpcomingByMarketId(int $marketId): FixtureCollection

Get all upcoming fixtures by market id:

$response = $api->fixtures()->getAllUpcomingByMarketId(1);

getAllUpcomingByTvStationId

getAllUpcomingByTvStationId(int $tvStationId): FixtureCollection

Get all upcoming fixtures by tv station id:

$response = $api->fixtures()->getAllUpcomingByTvStationId(1);

getAllPastByTvStationId

getAllPastByTvStationId(int $tvStationId): FixtureCollection

Get all past fixtures by tv station id:

$response = $api->fixtures()->getAllPastByTvStationId(1);

getAllLastUpdated

getAllLastUpdated(): FixtureCollection

Get all last updated fixtures:

$response = $api->fixtures()->getAllLastUpdated();

Leagues

getAll

getAll(): LeagueCollection

Get all leagues:

$response = $api->leagues()->getAll();

getById

getById(int $id): LeagueItem

Get league by id:

$response = $api->leagues()->getById(1);

getAllLive

getAllLive(): LeagueCollection

Get all leagues currently live:

$response = $api->leagues()->getAllLive();

getAllByFixtureDate

getAllByFixtureDate(\DateTimeInterface $date): LeagueCollection

Get all leagues with fixtures by date:

$response = $api->leagues()->getAllByFixtureDate(new DateTime('today'));

getAllByCountryId

getAllByCountryId(int $countryId): LeagueCollection

Get all leagues by country id:

$response = $api->leagues()->getAllByCountryId(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): LeagueCollection

Get all leagues by search query:

$response = $api->leagues()->getAllBySearchQuery('premiership');

getAllByTeamId

getAllByTeamId(int $teamId): LeagueCollection

Get all current and historical leagues by team id:

$response = $api->leagues()->getAllByTeamId(1);

getAllCurrentByTeamId

getAllCurrentByTeamId(int $teamId): LeagueCollection

Get all current leagues by team id:

$response = $api->leagues()->getAllCurrentByTeamId(1);

Livescores

getAll

getAll(): FixtureCollection

Get all fixtures of the current day:

$response = $api->livescores()->getAll();

getAllInplay

getAllInplay(): FixtureCollection

Get all fixtures that are already live, that will start within 15 minutes or that have finished in the past 15 minutes:

$response = $api->livescores()->getAllInplay();

getAllLastUpdated

getAllLastUpdated(): FixtureCollection

Get all fixtures that received updates in the last 10 seconds:

$response = $api->livescores()->getAllLastUpdated();

Players

getAll

getAll(): PlayerCollection

Get all players:

$response = $api->players()->getAll();

getById

getById(int $id): PlayerItem

Get player by id:

$response = $api->players()->getById(1);

getAllByCountryId

getAllByCountryId(int $countryId): PlayerCollection

Get all players by country id:

$response = $api->players()->getAllByCountryId(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): PlayerCollection

Get all players by search query:

$response = $api->players()->getAllBySearchQuery('esgaio');

getAllLastUpdated

getAllLastUpdated(): PlayerCollection

Get all players that received updates in the last couple of hours:

$response = $api->players()->getAllLastUpdated();

Referees

getAll

getAll(): RefereeCollection

Get all referees:

$response = $api->referees()->getAll();

getById

getById(int $id): RefereeItem

Get referee by id:

$response = $api->referees()->getById(1);

getAllByCountryId

getAllByCountryId(int $countryId): RefereeCollection

Get all referees by country id:

$response = $api->referees()->getAllByCountryId(1);

getAllBySeasonId

getAllBySeasonId(int $seasonId): RefereeCollection

Get all referees by season id:

$response = $api->referees()->getAllBySeasonId(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): RefereeCollection

Get all referees by search query:

$response = $api->referees()->getAllBySearchQuery('name');

Rivals

getAll

getAll(): RivalCollection

Get all rivals:

$response = $api->rivals()->getAll();

getAllByTeamId

getAllByTeamId(int $teamId): RivalCollection

Get all rivals by team id:

$response = $api->rivals()->getAllByTeamId(1);

Rounds

getAll

getAll(): RoundCollection

Get all rounds:

$response = $api->rounds()->getAll();

getById

getById(int $id): RoundItem

Get round by id:

$response = $api->rounds()->getById(1);

getAllBySeasonId

getAllBySeasonId(int $seasonId): RoundCollection

Get all rounds by season id:

$response = $api->rounds()->getAllBySeasonId(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): RoundCollection

Get all rounds by search query:

$response = $api->rounds()->getAllBySearchQuery('30');

Schedules

getAllBySeasonId

getAllBySeasonId(int $seasonId): StageCollection

Get complete season schedule by season id:

$response = $api->schedules()->getAllBySeasonId(1);

getAllByTeamId

getAllByTeamId(int $teamId): StageCollection

Get complete schedule for all active seasons by team id:

$response = $api->schedules()->getAllByTeamId(1);

getAllBySeasonIdAndTeamId

getAllBySeasonIdAndTeamId(int $seasonId, int $teamId): StageCollection

Get complete season schedule for one team by season id and team id:

$response = $api->schedules()->getAllBySeasonIdAndTeamId(1, 1);

Seasons

getAll

getAll(): SeasonCollection

Get all seasons:

$response = $api->seasons()->getAll();

getById

getById(int $id): SeasonItem

Get season by id:

$response = $api->seasons()->getById(1);

getAllByTeamId

getAllByTeamId(int $teamId): SeasonCollection

Get all seasons by team id:

$response = $api->seasons()->getAllByTeamId(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): SeasonCollection

Get all seasons by search query:

$response = $api->seasons()->getAllBySearchQuery('2024');

Stages

getAll

getAll(): StageCollection

Get all stages:

$response = $api->stages()->getAll();

getById

getById(int $id): StageItem

Get stage by id:

$response = $api->stages()->getById(1);

getAllBySeasonId

getAllBySeasonId(int $seasonId): StageCollection

Get all stages by season id:

$response = $api->stages()->getAllBySeasonId(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): StageCollection

Get all stages by search query:

$response = $api->stages()->getAllBySearchQuery('champions');

Standings

getAll

getAll(): StandingCollection

Get all standings:

$response = $api->standings()->getAll();

getAllBySeasonId

getAllBySeasonId(int $seasonId): StandingCollection

Get all standings by season id:

$response = $api->standings()->getAllBySeasonId(1);

getAllCorrectionsBySeasonId

getAllCorrectionsBySeasonId(int $seasonId): StandingCorrectionCollection

Get all standing corrections by season id:

$response = $api->standings()->getAllCorrectionsBySeasonId(1);

getAllByRoundId

getAllByRoundId(int $roundId): StandingCollection

Get all standings by round id:

$response = $api->standings()->getAllByRoundId(1);

getAllLiveByLeagueId

getAllLiveByLeagueId(int $leagueId): StandingCollection

Get all live standings by league id:

$response = $api->standings()->getAllLiveByLeagueId(1);

States

getAll

getAll(): StateCollection

Get all states:

$response = $api->states()->getAll();

getById

getById(int $id): StateItem

Get state by id:

$response = $api->states()->getById(1);

Statistics

getAllByPlayerId

getAllByPlayerId(int $playerId): PlayerStatisticCollection

Get all statistics by player id per season:

$response = $api->statistics()->getAllByPlayerId(1);

getAllByTeamId

getAllByTeamId(int $teamId): TeamStatisticCollection

Get all statistics by team id per season:

$response = $api->statistics()->getAllByTeamId(1);

getAllByCoachId

getAllByCoachId(int $coachId): CoachStatisticCollection

Get all statistics by coach id per season:

$response = $api->statistics()->getAllByCoachId(1);

getAllByRefereeId

getAllByRefereeId(int $refereeId): RefereeStatisticCollection

Get all statistics by referee id per season:

$response = $api->statistics()->getAllByRefereeId(1);

getAllByStageId

getAllByStageId(int $stageId): StatisticCollection

Get all statistics by stage id:

$response = $api->statistics()->getAllByStageId(1);

getAllByRoundId

getAllByRoundId(int $roundId): StatisticCollection

Get all statistics by round id:

$response = $api->statistics()->getAllByRoundId(1);

Teams

getAll

getAll(): TeamCollection

Get all teams:

$response = $api->teams()->getAll();

getById

getById(int $id): TeamItem

Get team by id:

$response = $api->teams()->getById(1);

getAllByCountryId

getAllByCountryId(int $countryId): TeamCollection

Get all teams by country id:

$response = $api->teams()->getAllByCountryId(1);

getAllBySeasonId

getAllBySeasonId(int $seasonId): TeamCollection

Get all teams by season id:

$response = $api->teams()->getAllBySeasonId(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): TeamCollection

Get all teams by search query:

$response = $api->teams()->getAllBySearchQuery('sporting');

Team Squads

getAllByTeamId

getAllByTeamId(int $teamId): TeamSquadCollection

Get complete team squad by team id:

$response = $api->teamSquads()->getAllByTeamId(1);

getAllExtendedByTeamId

getAllExtendedByTeamId(int $teamId): PlayerCollection

Get complete team squad entries based on the current season by team id:

$response = $api->teamSquads()->getAllExtendedByTeamId(1);

getAllBySeasonIdAndTeamId

getAllBySeasonIdAndTeamId(int $seasonId, int $teamId): TeamSquadCollection

Get complete team squad of one team by season id and team id:

$response = $api->teamSquads()->getAllBySeasonIdAndTeamId(1, 1);

Topscorers

getAllBySeasonId

getAllBySeasonId(int $seasonId): SeasonCollection

Get all topscorers by season id:

$response = $api->topscorers()->getAllBySeasonId(1);

getAllByStageId

getAllByStageId(int $stageId): SeasonCollection

Get all topscorers by stage id:

$response = $api->topscorers()->getAllByStageId(1);

Transfers

getAll

getAll(): TransferCollection

Get all transfers:

$response = $api->transfers()->getAll();

getById

getById(int $id): TransferItem

Get transfer by id:

$response = $api->transfers()->getById(1);

getAllLatest

getAllLatest(): TransferCollection

Get the latest transfers:

$response = $api->transfers()->getAllLatest();

getAllByDateRange

getAllByDateRange(\DateTimeInterface $startDate, \DateTimeInterface $endDate): TransferCollection

Get all transfers by date range:

$response = $api->transfers()->getAllByDateRange(new DateTime('-7 days'), new DateTime('today'));

getAllByTeamId

getAllByTeamId(int $teamId): TransferCollection

Get all transfers by team id:

$response = $api->transfers()->getAllByTeamId(1);

getAllByPlayerId

getAllByPlayerId(int $playerId): TransferCollection

Get all transfers by player id:

$response = $api->transfers()->getAllByPlayerId(1);

TV Stations

getAll

getAll(): TvStationCollection

Get all tv stations:

$response = $api->tvStations()->getAll();

getById

getById(int $id): TvStationItem

Get tv station by id:

$response = $api->tvStations()->getById(1);

getAllByFixtureId

getAllByFixtureId(int $fixtureId): TvStationCollection

Get all tv stations by fixture id:

$response = $api->tvStations()->getAllByFixtureId(1);

Venues

getAll

getAll(): VenueCollection

Get all venues:

$response = $api->venues()->getAll();

getById

getById(int $id): VenueItem

Get venue by id:

$response = $api->venues()->getById(1);

getAllBySeasonId

getAllBySeasonId(int $seasonId): VenueCollection

Get all venues by season id:

$response = $api->venues()->getAllBySeasonId(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): VenueCollection

Get all venues by search query:

$response = $api->venues()->getAllBySearchQuery('alvalade');

Odds Endpoints

Bookmakers

getAll

getAll(): BookmakerCollection

Get all bookmakers:

$response = $api->bookmakers()->getAll();

getById

getById(int $id): BookmakerItem

Get bookmaker by id:

$response = $api->bookmakers()->getById(1);

getAllByFixtureId

getAllByFixtureId(int $fixtureId): BookmakerCollection

Get all bookmakers by fixture id:

$response = $api->bookmakers()->getAllByFixtureId(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): BookmakerCollection

Get all bookmakers by search query:

$response = $api->bookmakers()->getAllBySearchQuery('bet');

Markets

getAll

getAll(): MarketCollection

Get all markets:

$response = $api->markets()->getAll();

getById

getById(int $id): MarketItem

Get market by id:

$response = $api->markets()->getById(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): MarketCollection

Get all markets by search query:

$response = $api->markets()->getAllBySearchQuery('goal');

Pre-match Odds

getAll

getAll(): OddCollection

Get all pre-match odds:

$response = $api->preMatchOdds()->getAll();

getAllByFixtureId

getAllByFixtureId(int $fixtureId): OddCollection

Get all pre-match odds by fixture id:

$response = $api->preMatchOdds()->getAllByFixtureId(1);

getAllByFixtureIdAndBookmakerId

getAllByFixtureIdAndBookmakerId(int $fixtureId, int bookmakerId): OddCollection

Get all pre-match odds by fixture id and bookmaker id:

$response = $api->preMatchOdds()->getAllByFixtureIdAndBookmakerId(1, 1);

getAllByFixtureIdAndMarketId

getAllByFixtureIdAndMarketId(int $fixtureId, int marketId): OddCollection

Get all pre-match odds by fixture id and market id:

$response = $api->preMatchOdds()->getAllByFixtureIdAndMarketId(1, 1);

getAllLastUpdated

getAllLastUpdated(): OddCollection

Get all last updated pre-match odds:

$response = $api->preMatchOdds()->getAllLastUpdated();

Core Endpoints

Cities

getAll

getAll(): CityCollection

Get all cities:

$response = $api->cities()->getAll();

getById

getById(int $id): CityItem

Get city by id:

$response = $api->cities()->getById(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): CityCollection

Get all cities by search query:

$response = $api->cities()->getAllBySearchQuery('lisbon');

Continents

getAll

getAll(): ContinentCollection

Get all continents:

$response = $api->continents()->getAll();

getById

getById(int $id): ContinentItem

Get continent by id:

$response = $api->continents()->getById(1);

Countries

getAll

getAll(): CountryCollection

Get all countries:

$response = $api->countries()->getAll();

getById

getById(int $id): CountryItem

Get country by id:

$response = $api->countries()->getById(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): CountryCollection

Get all countries by search query:

$response = $api->countries()->getAllBySearchQuery('country');

Filters

getAllByEntity

getAllByEntity(): FilterEntityCollection

Get all filters grouped by entity:

$response = $api->filters()->getAllByEntity();

Regions

getAll

getAll(): RegionCollection

Get all regions:

$response = $api->regions()->getAll();

getById

getById(int $id): RegionItem

Get region by id:

$response = $api->regions()->getById(1);

getAllBySearchQuery

getAllBySearchQuery(string $query): RegionCollection

Get all regions by search query:

$response = $api->regions()->getAllBySearchQuery('lisboa');

Timezones

getAll

getAll(): TimezoneCollection

Get all timezones:

$response = $api->timezones()->getAll();

Types

getAll

getAll(): TypeCollection

Get all types:

$response = $api->types()->getAll();

getById

getById(int $id): TypeItem

Get type by id:

$response = $api->types()->getById(1);

getAllByEntity

getAllByEntity(): TypeEntityCollection

Get all types grouped by entity:

$response = $api->types()->getAllByEntity();

Pagination

withPage

withPage(int $page): self

Determine the results page number.

// show page 2 of the results
$api->fixtures()
    ->withPage(2)
    ->getAll();

withPerPage

withPerPage(int $perPage): self

Determine the number of results per page. Please note that it only affects the results of the base entity, so includes are not paginated.

// show 50 entries per page
$api->fixtures()
    ->withPerPage(50)
    ->getAll();

withSortBy

withSortBy(string $sortBy): self

Specifies the field by which the data will be sorted.

// results sorted by the "starting_at" field
$api->fixtures()
    ->withSortBy('starting_at')
    ->getAll();

For all available sorting options, check the official documentation.

withOrder

withOrder(string $order): self

Determines the order in which the data will be sorted.

// results in descending order
$api->fixtures()
    ->withOrder('desc')
    ->getAll();

For all available order options, check the official documentation.

withPagination

withPagination(int $page, int $perPage = 25, ?string $sortBy = null, string $order = 'asc'): self

Shorthand version of the combined withPage, withPerPage, withSortBy and withOrder methods.

// returns page 5 with 50 fixtures per page sorted by "starting_at" in descending order
$api->fixtures()
    ->withPagination(5, 50, 'starting_at', 'desc')
    ->getAll();

// equivalent to
$api->fixtures()
    ->withPage(5)
    ->withPerPage(50)
    ->withSortBy('starting_at')
    ->withOrder('desc')
    ->getAll();

Select, Include and Filters

withSelect

withSelect(string $select): self

It is possible to request only specific fields on entities and on includes. The advantage of selecting specific fields is that it reduces the response speed in mainly large responses. In addition to reducing response time, the response size is also reduced.

For selecting fields on includes, check the withInclude section.

// get fixture with fields "name" and "starting_at" only
$api->fixtures()
    ->withSelect('name,starting_at')
    ->getById(1);

To better understand how it works, check the official documentation.

withInclude

withInclude(string $include): self

Includes allow to enrich the response with relational data. This means that it is possible to request a fixture and have the venue data in the same response without any additional requests. To check what includes ara available per endpoint, check the following documentation.

// get fixture with "venue" and "participants" (teams) data
$api->fixtures()
    ->withInclude('venue,participants')
    ->getById(1);

// it is also possible to get nested includes
// this will return venue data and country data inside the venue
$api->fixtures()
    ->withInclude('venue.country')
    ->getById(1);

To better understand how it works, check the official documentation.

To select fields in includes (similar to the withSelect), you can do the following:

// get fixture with "venue" data with fields "name" and "city_name" only
$api->fixtures()
    ->withInclude('venue:name,city_name')
    ->getById(1);

withFilter

withFilter(string $filter): self

Filters are useful to make conditional requests. For example, get fixture events that are only goals:

// get fixture with "events" that are only goals, own goals or penalties.
$api->fixtures()
    ->withInclude('events')
    ->withFilter('eventTypes:14,15,16'])
    ->getById(1);

To better understand how it works, check the official documentation.

Timezone, Language and Cache TTL

withTimezone

withTimezone(string $timezone): self

Makes a request with a different timezone from the one globally defined in the configuration.

Check the official documentation for more information.

// get all fixtures in the Europe/Lisbon timezone
$api->fixtures()
    ->withTimezone('Europe/Lisbon')
    ->getAll();

withLanguage

withLanguage(string $language): self

Makes a request with a different language from the one globally defined in the configuration.

Check the official documentation for more information.

Note

This is feature is still in beta and may change in the future.

// get all fixtures in Japanese
$api->fixtures()
    ->withLanguage(Language::JAPANESE)
    ->getAll();

withCacheTtl

withCacheTtl(?int $ttl): self

Makes a request and saves into cache for the provided duration in seconds.

Semantics of values:

  • 0, the response will not be cached (if the servers specifies no max-age).
  • null, the response will be cached for as long as it can (forever).

Note

Setting cache to null or 0 seconds will not invalidate any existing cache.

Available for all APIs if a cache adapter is set. Check the following documentation for more information.

// Get all fixtures and cache for 1 day
$api->fixtures()
    ->withCacheTtl(3600 * 24)
    ->getAll();