Easily retrieve and use League of Legends data in your web and mobile (Android) apps!
Download the .jar file, and add it as an external library to your project.
If you are using Eclipse, this can be done by right clicking your project, and selecting:
Build Path -> Configure Build Path -> Libraries -> Add External Jars
and selecting the jar under the Order and Export tab.
This library can be used strictly according to the Riot API Documentation like so:
import java.util.Map; import constant.Region; import dto.Summoner.Summoner; import main.java.riotapi.RiotApi; import com.google.gson*; public class Example { public static void main(String[] args) throws RiotApiException { RiotApi api = new RiotApi("YOUR-API-KEY-HERE"); Mapsummoners = api.getSummonersByName(Region.NA, "rithms, tryndamere"); Summoner summoner = summoners.get("rithms"); long id = summoner.getId(); System.out.println(id); } }
Available accessors allow you to accomplish similar tasks in a different way. Below is an example of how to set your region. Because the region was set before a method was called, there is no need to pass in the region parameter. This is great for people that know they will only be working in one region when making multiple requests. The same can be done for the season.
import java.util.Map; import constant.Region; import dto.Summoner.Summoner; import main.java.riotapi.RiotApi; import com.google.gson*; public class Example { public static void main(String[] args) throws RiotApiException { RiotApi api = new RiotApi("YOUR-API-KEY-HERE"); api.setRegion(Region.NA); Mapsummoners = api.getSummonersByName("rithms, tryndamere"); Summoner summoner = summoners.get("rithms"); long id = summoner.getId(); System.out.println(id); } }
It is important to be aware of your personal rate limit. Any method call from the RiotAPI is a request that counts towards your rate limit, with exceptions to the accessors/mutators of region, key, and season, as well as any requests regarding static data. The below code makes 2 requests; one request for a summoner, and another for ranked stats of a summoner.
import constant.Region; import constant.Season; import dto.Stats.RankedStats; import main.java.riotapi.RiotApi; import com.google.gson*; public class Example { public static void main(String[] args) throws RiotApiException { RiotApi api = new RiotApi("YOUR-API-KEY-HERE", Region.NA); api.setSeason(Season.FIVE); RankedStats rankedStats = api.getRankedStats(api.getSummonersByName("rithms, tryndamere").get("rithms").getId()); } }
API | Servers | Support |
---|---|---|
champion-v1.2 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
current-game-v1.0 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
featured-games-v1.0 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
game-v1.3 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
league-v2.5 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
lol-static-data-v1.2 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
lol-status-v1.0 | [BR, EUNE, EUW, LAN, LAS, NA, OCE, PBE, RU, TR] | Yes |
match-v2.2 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
matchlist-v2.2 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
matchhistory-v2.2 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
stats-v1.3 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
summoner-v1.4 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
team-v2.4 | [BR, EUNE, EUW, KR, LAN, LAS, NA, OCE, RU, TR] | Yes |
Rate Limit = api-version
No Limit = api-version
Return Type | Method | API |
---|---|---|
ChampionList | getChampions(Region region, boolean freeToPlay) | champion-v1.2 |
Champion | getChampionById(Region region, int champId) | champion-v1.2 |
CurrentGameInfo | getCurrentGameInfo(PlatformId platformId, long summonerId) | current-game-v1.0 |
FeaturedGames | getFeaturedGames(Region region) | featured-games-v1.0 |
RecentGames | getRecentGames(Region region, long summonerId) | game-v1.3 |
Map<String, List<League>> | getLeagueBySummoners(Region region, long... summonerIds) | league-v2.5 |
Map<String, List<League>> | getLeagueEntryBySummoners(Region region, long... summonerIds) | league-v2.5 |
Map<String, List<League>> | getLeagueByTeams(Region region, long... teamIds) | league-v2.5 |
Map<String, List<League>> | getLeagueEntryByTeams(Region region, long... teamIds) | league-v2.5 |
League | getChallengerLeagues(Region region, QueueType queueType) | league-v2.5 |
League | getMasterLeagues(Region region, QueueType queueType) | league-v2.5 |
ChampionList | getDataChampionList(Region region, String locale, String version, boolean dataById, ChampData... champData) | lol-static-data-v1.2 |
Champion | getDataChampion(Region region, int id, String locale, String version, boolean dataById, ChampData... champData) | lol-static-data-v1.2 |
ItemList | getDataItemList(Region region, String locale, String version, ItemListData... itemListData) | lol-static-data-v1.2 |
Item | getDataItem(Region region, int id, String locale, String version, ItemData... itemData) | lol-static-data-v1.2 |
Realm | getDataRealm(Region region) | lol-static-data-v1.2 |
RuneList | getDataRuneList(Region region, String locale, String version, RuneListData... runeListData) | lol-static-data-v1.2 |
Rune | getDataRune(Region region, int id, String locale, String version, RuneData... runeData) | lol-static-data-v1.2 |
MasteryList | getDataMasteryList(Region region, String locale, String version, MasteryListData... masteryListData) | lol-static-data-v1.2 |
Mastery | getDataMastery(Region region, int id, String locale, String version, MasteryData... masteryData) | lol-static-data-v1.2 |
SummonerSpellList | getDataSummonerSpellList(Region region, String locale, String version, boolean dataById, SpellData... spellData) | lol-static-data-v1.2 |
SummonerSpell | getDataSummonerSpell(Region region, int id, String locale, String version, SpellData... spellData) | lol-static-data-v1.2 |
List<String> | getDataVersions(Region region) | lol-static-data-v1.2 |
List<String> | getDataLanguages(Region region) | lol-static-data-v1.2 |
GameMapList | getDataGameMapList(Region region, String locale, String version) | lol-static-data-v1.2 |
LanguageStrings | getDataLanguageStrings(Region region, String locale, String version) | lol-static-data-v1.2 |
List<Shard> | getShards() | lol-status-v1.0 |
ShardStatus | getShardStatus(Region region) | lol-status-v1.0 |
MatchDetail | getMatch(Region region, long matchId) | match-v2.2 |
MatchList | getMatchList(Region region, long summonerId, String championIds, String rankedQueues, String seasons, long beginTime, long endTime, int beginIndex, int endIndex) | matchlist-v2.2 |
RankedStats | getRankedStats(Region region, Season season, long summonerId) | stats-v1.3 |
PlayerStatsSummaryList | getPlayerStatsSummary(Region region, Season season, long summonerId) | stats-v1.3 |
Map<String, Summoner> | getSummonersByName(Region region, String summonerNames) | summoner-v1.4 |
Map<String, Summoner> | getSummonersById(Region region, long... summonerIds) | summoner-v1.4 |
Map<String, String> | getSummonerNames(Region region, long... summonerIds) | summoner-v1.4 |
Map<String, MasteryPages> | getMasteryPages(Region region, String summonerIds) | summoner-v1.4 |
Map<String, RunePages> | getRunePages(Region region, String summonerIds) | summoner-v1.4 |
Map<String, List<Team>> | getTeamsBySummonerIds(Region region, long... summonerIds) | team-v2.4 |
Map<String, Team> | getTeamsByTeamIds(Region region, long... teamIds) | team-v2.4 |
Most of these methods have overloaded versions if you have no use for some of the optional parameters. For more information and details about the methods of this library, use the javadoc page.
Also note, this library strictly follows the conventions of the official API. Therefore you may find the official Riot Games API Reference to be useful as well.