Skip to content

Sending the Request

supergrecko edited this page Apr 22, 2019 · 8 revisions

Now that your Client is configured and ready to go, we'll have a look at how to fetch data from the API.

RiotQuest provides a simple interface to pull data from the API. Everything is done from the RiotQuest\Client class. Here's an example.

<?php

require __DIR__ . '/vendor/autoload.php';

use RiotQuest\Client;

Client::boot();

// GET account data from north-america and cache the response for 3600 seconds
$summoner = Client::summoner('na1', 3600)->name('RiotSchmick');

?>

This will pull the summoner data from RiotSchmick's account and put it inside a SummonerCollection. You can read more about return types here.

Schema

Every single endpoint takes two arguments: region and ttl. l

The ttl parameter defines how many seconds the item will reside inside the cache. If we for example tell it to cache an item for an hour, any requests to this same endpoint will pull the data that was grabbed the first time for an hour. After the hour expires, the framework will request fresh data. This is done to save your rate limit.

The region parameter is to define which region you're sending the request to.

There's region aliases for every region to simplify regions. You can see every definition here.

API Reference

Champion Mastery V4

The Champion Mastery V4 endpoints are located under the Client::mastery methods.

Method Arguments Response Type Description
Mastery::all() string $id: Encrypted Summoner ID ChampionMasteryList Get every mastery record for summoner.
Mastery::id() string $id: Encrypted Summoner ID, int $champion: Champion ID ChampionMastery Get a single record by champion id for summoner.
Mastery::score() string $id: Encrypted Summoner ID Integer Get the total champion score points for summoner.

Champion V3

The Champion V3 endpoints are located under the Client::champion methods.

Method Arguments Response Type Description
Champion::rotation() None ChampionInfo Get the current Champion rotations.

League V4

The League V4 endpoints are located under the Client::league methods.

Game Queue can be either 'RANKED_SOLO_5x5', 'RANKED_FLEX_SR' or 'RANKED_FLEX_TT'.

Method Arguments Response Type Description
League::id() string $id: League ID League Get a League by its league id.
League::challenger() string $queue: Game Queue League Get the current challenger ladder.
League::master() string $queue: Game Queue League Get the current master ladder.
League::grandmaster() string $queue: Game Queue League Get the current grandmaster ladder.
League::positions() string $id: Encrypted Summoner ID LeaguePositionList Get the current positions for a summoner

LOL Status V3

The LOL Status V3 endpoints are located under the Client::status methods.

Method Arguments Response Type Description
Status::shard() None ShardData Gets the current league status data.

Match V4

The Match V4 endpoints are located under the Client::match methods.

Method Arguments Response Type Description
Match::id() double $id: Game ID Match Get the data for the given match.
Match::list() string $id: Encrypted Account ID MatchHistory Get the match list for given account id.
Match::timeline() double $id: Game ID MatchTimeline Get the timeline for given match.

RiotQuest does not support Tournament related endpoints at the moment.

Spectator V4

The Spectator V4 endpoints are located under the Client::spectator methods.

Method Arguments Response Type Description
Spectator::featured() None FeaturedGameInfoList Get the featured games.
Spectator::active() string $id: Encrypted Summoner ID CurrentGameInfo Get the live game of a summoner.

Summoner V4

The Summoner V4 endpoints are located under the Client::summoner methods.

Method Arguments Response Type Description
Summoner::name() string $id: Summoner Name Summoner Get the summoner by name.
Summoner::id() string $id: Encrypted Summoner ID Summoner Get the summoner by encrypted summoner id.
Summoner::account() string $id: Encrypted Account ID Summoner Get the summoner by encrypted account id.
Summoner::unique() string $id: PUUID Summoner Get the summoner by PUUID.

Third Party Code V4

The Third Party Code V4 endpoints are located under the Client::code methods.

Method Arguments Response Type Description
Code::id() string $id: Encrypted Summoner ID String Get the summoners third party code.

Responses

Each of the above endpoints, with some exceptions return an object which extends RiotQuest\Components\Framework\Collections\Collection. Visit Return Types to learn more about collections.

Next Steps

After sending your request you'll want to work with the response. Moving onto "Handing the Response"

Clone this wiki locally
You can’t perform that action at this time.