Skip to content

Latest commit

History

580 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation


JitPack

A simple to use, Riot Games API wrapper for Java. This library makes it easy to gather and use League of Legends data in your apps.

Disclaimer

This product is not endorsed, certified or otherwise approved in any way by Riot Games, Inc. or any of its affiliates.

Requirements

riot-api-java requires Java 7 and the following libraries:

Setup

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 project is also available on Jitpack

Gradle

Add Jitpack to your root build.gradle at the end of repositories:

allprojects {
repositories {
...
maven { url'https://jitpack.io' }
}
}

Add the project as a dependency:

dependencies {
compile'com.github.taycaldwell:riot-api-java:4.0.1'
}

Maven

Add Jitpack as a repository:

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

Add the project as a dependency:

<dependency>
<groupId>com.github.taycaldwell</groupId>
<artifactId>riot-api-java</artifactId>
<version>4.0.1</version>
</dependency>

Usage

This library can be used strictly according to the Riot API Documentation like so:

importnet.rithms.riot.api.ApiConfig;
importnet.rithms.riot.api.RiotApi;
importnet.rithms.riot.api.RiotApiException;
importnet.rithms.riot.api.endpoints.summoner.dto.Summoner;
importnet.rithms.riot.constant.Platform;
/** * This example demonstrates using the RiotApi to request summoner information for a given summoner name */publicclassSummonerExample {
publicstaticvoidmain(String[] args) throwsRiotApiException {
ApiConfigconfig = newApiConfig().setKey("YOUR-API-KEY-HERE");
RiotApiapi = newRiotApi(config);
Summonersummoner = api.getSummonerByName(Platform.NA, "tryndamere");
System.out.println("Name: " + summoner.getName());
System.out.println("Summoner ID: " + summoner.getId());
System.out.println("Account ID: " + summoner.getAccountId());
System.out.println("Summoner Level: " + summoner.getSummonerLevel());
System.out.println("Profile Icon ID: " + summoner.getProfileIconId());
}
}

It is important to be aware of your personal rate limit. Any method call from the Riot API is a request that counts towards your rate limit, except requests regarding static data which count toward a method rate limit but not toward your app rate limit. The below code makes 2 requests; one request for a summoner, and another for the match list of a summoner.

importnet.rithms.riot.api.ApiConfig;
importnet.rithms.riot.api.RiotApi;
importnet.rithms.riot.api.RiotApiException;
importnet.rithms.riot.api.endpoints.match.dto.MatchList;
importnet.rithms.riot.api.endpoints.match.dto.MatchReference;
importnet.rithms.riot.api.endpoints.summoner.dto.Summoner;
importnet.rithms.riot.constant.Platform;
/** * This example demonstrates using the RiotApi to request the match list for a given summoner name and iterating over the match list */publicclassMatchListExample {
publicstaticvoidmain(String[] args) throwsRiotApiException {
ApiConfigconfig = newApiConfig().setKey("YOUR-API-KEY-HERE");
RiotApiapi = newRiotApi(config);
// First we need to request the summoner because we will need it's account IDSummonersummoner = api.getSummonerByName(Platform.NA, "tryndamere");
// Then we can use the account ID to request the summoner's match listMatchListmatchList = api.getMatchListByAccountId(Platform.NA, summoner.getAccountId());
System.out.println("Total Games in requested match list: " + matchList.getTotalGames());
// We can now iterate over the match list to access the dataif (matchList.getMatches() != null) {
for (MatchReferencematch : matchList.getMatches()) {
System.out.println("GameID: " + match.getGameId());
}
}
}
}

You can find these and more examples in the repository's directory "examples".

Documentation

The documentation for this library can be found here.

API Versions

The current version of this library supports the following Riot Games API versions:

  • CHAMPION-MASTERY-V3
  • CHAMPION-V3
  • LEAGUE-V3
  • LOL-STATUS-V3
  • MATCH-V3
  • SPECTATOR-V3
  • STATIC-DATA-V3
  • SUMMONER-V3
  • THIRD-PARTY-CODE-V3
  • TOURNAMENT-V3
  • TOURNAMENT-STUB-V3

Contributing

All contributions are appreciated. If you would like to contribute to this project, please send a pull request.

Contact

Have a suggestion, complaint, or question? Open an issue.

About

Riot Games API Java Library

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages