Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.alex-place:riot-api-java:v3.9.1'
}
dependencies {
implementation("com.github.alex-place:riot-api-java:v3.9.1")
}
<dependency>
<groupId>com.github.alex-place</groupId>
<artifactId>riot-api-java</artifactId>
<version>v3.9.1</version>
</dependency>
libraryDependencies += "com.github.alex-place" % "riot-api-java" % "v3.9.1"
:dependencies [[com.github.alex-place/riot-api-java "v3.9.1"]]
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.
This product is not endorsed, certified or otherwise approved in any way by Riot Games, Inc. or any of its affiliates.
riot-api-java requires Java 7 and the following libraries:
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
This library can be used strictly according to the Riot API Documentation like so:
import java.util.Map;
import net.rithms.riot.constant.Region;
import net.rithms.riot.dto.Summoner.Summoner;
import net.rithms.riot.api.RiotApi;
import net.rithms.riot.api.RiotApiException;
import com.google.gson*;
public class Example {
public static void main(String[] args) throws RiotApiException {
ApiConfig config = new ApiConfig();
config.setKey("YOUR-API-KEY-HERE");
RiotApi api = new RiotApi(config);
Map<String, Summoner> summoners = api.getSummonersByName(Region.NA, "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 net.rithms.riot.constant.Region;
import net.rithms.riot.constant.Season;
import net.rithms.riot.dto.Stats.RankedStats;
import net.rithms.riot.api.RiotApi;
import net.rithms.riot.api.RiotApiException;
import com.google.gson*;
public class Example {
public static void main(String[] args) throws RiotApiException {
ApiConfig config = new ApiConfig();
config.setKey("YOUR-API-KEY-HERE");
RiotApi api = new RiotApi(config);
api.setSeason(Season.FIVE);
RankedStats rankedStats = api.getRankedStats(api.getSummonerByName("rithms").getId());
}
}
The documentation for this library can be found here.
The current version of this library supports the following Riot Games API versions:
All contributions are appreciated. If you would like to contribute to this project, please send a pull request.
Have a suggestion, complaint, or question? Open an issue.