taycaldwell / riot-api-java

Riot Games API Java Library
http://taycaldwell.github.io/riot-api-java/
Apache License 2.0
192 stars 73 forks source link

403 Forbidden #156

Closed 01Parzival10 closed 4 years ago

01Parzival10 commented 4 years ago

I'm completly new so maybe I'm just an Idoit. But when i try to:

try { Summoner summoner = api.getSummonerByName(Platform.EUW, args[2]); channel.sendMessage("Name: " + summoner.getName()).queue(); channel.sendMessage("Summoner Level: " + summoner.getSummonerLevel()).queue();

            Set<LeaguePosition> leagues = api.getLeaguePositionsBySummonerId(Platform.EUW, summoner.getId());
            for (LeaguePosition league : leagues) {
                channel.sendMessage(league.getLeagueName() + ": " + league.getRank() + " " + league.getLeaguePoints()).queue();
            }

        } catch (RiotApiException e) {
            e.printStackTrace();
            return;
        }`

I get following Error:

net.rithms.riot.api.RiotApiException: 403: Forbidden at net.rithms.riot.api.request.Request.execute(Request.java:181) at net.rithms.riot.api.request.Request.(Request.java:94) at net.rithms.riot.api.EndpointManager.callMethodAndReturnDto(EndpointManager.java:52) at net.rithms.riot.api.RiotApi.getLeaguePositionsBySummonerId(RiotApi.java:1557) at Commands.RitoTest.performCommand(RitoTest.java:34)

I renewed my DevKey so this shouldn't be a problem.

Nauschi commented 4 years ago

Hi,

seems like the endpoint that's used by GetLeaguePositionsBySummonerId.java is outdated.

Go to GetLeaguePositionsBySummonerId.java and change the urlBase from /lol/league/v4/positions/by-summoner/ to /lol/league/v4/entries/by-summoner/

The DTO doesn't seem to have been changed. Only the endpoint

01Parzival10 commented 4 years ago

Thank you. I was using Version 4.2 thats prob. what was wrong