Search code examples
jsonriot-games-api

Riot Api - How can I bring the data of user in other regions?


I am trying to get user data from other regions using Riot Api

I am able to get a data from North America region but not able to bring user data from other regions such as Brazil.

I have found about regional endpoints but how I can use this to bring user data from specific region?


Solution

  • You have some options here:

    Option #1: If you use Riot's UI in the Full Api Reference, then there is a dropdown list for every endpoint to select a different region from:

    Riot API UI

    Option #2: If you build the request URL yourself, then you have to use the specific host from the table for regional endpoints. So, for example, if you want to see the featured games list for the brazil region, then you have to get the host 'br1.api.riotgames.com', add the endpoint '/lol/spectator/v4/featured-games' to it and add your apikey as a query paramater. Like that:

    https://br1.api.riotgames.com/lol/spectator/v4/featured-games?api_key=<your_apikey>
    

    That option is described here.

    Option #3: Use one of the many api wrappers in your favourite programming language. I myself am using this one in Java. With such an api wrapper you can make a request for featured games like that:

    ApiConfig config = new ApiConfig().setKey(<your_apikey>);
    FeaturedGames games = RiotApi(config).getFeaturedGames(Platorm.BR1);