📜 ⬆️ ⬇️

Elophant: at least some access to API League of Legends



I am sure that many of those who even sometimes play games of the MOBA (Multiplayer Online Battle Arena) genre, or even simply in the MMORPG, have probably heard about such a project as League of Legends .
LoL is the second (after Demigod) clone of the well-known "Dota", and, at the moment, has a lot of fans around the globe (30+ million registered users). In the 2010-2011 League of Legends was even included in the list of disciplines at the largest championship for gamers - WCG (World Cyber ​​Games).

However, stop praising the already lauded game, let's get down to business. Once, I was impressed to find out detailed information about my game account in LoL, namely: to see the results of my last matches played, the overall game statistics for each character and the corresponding KDA Ratio values ​​(Kills / Deaths / Assissts). But I needed to find out this information without having a client with the game at hand. I shoveled the entire official website and forum, looking for at least some information about the API - all without success. Then, I did not know about the resources LoLKing, SoloMid, etc.
')
Much later, in the process of “googling”, the site Elophant.com was found, on which was located (actually, and now is located) a small API - documentation. It describes the main methods that allow you to find out the name of a summoner, information about his runes / talent pages, information about the last ten games played, general game statistics, information about all existing game objects / characters, etc.

The About section of the site in question says the following:
How it works? Once the information is entered, Elophant queries Riot's database ...
(Riots Games is a developer and publisher of League of Legends). That is, the Elophant resource itself is only an intermediary, between the user and the Riot servers. But for me personally, it doesn’t matter: it works and it’s okay.

First of all, you have to register to get a unique key to access the API. Got the key? Fine. Work with the service is carried out using GET requests, which have the form api.elophant.com/v2/region/resource/params/params?key=key, where:



The answer to all requests comes in JSON format, which greatly simplifies its processing. In PHP, for example, it suffices to use the json_decode method (string json, TRUE), and you already have an associative array on hand, from which you pull out any information you need.

For example, consider the use of the GET summoner method, which allows you to find out the Summoner's ID (necessary for working with some other methods), the in-game nickname, the player level and the ID of the profile icon. Getting this information is very simple (php):
<?php $region = "euw"; $method = "summoner"; $params = "summoner_name"; $key = "here_comes_your_key"; $data = json_decode(file_get_contents("http://api.elophant.com/v2/".$region."/".$method."/".$params."?key=".$key), TRUE); print_r($data); echo "<br />".$data["data"]["summonerId"]; ?> 

On the screen we will have our entire resulting array and a separate line - the player ID.

List of main External methods:
MethodOptionsDescription
GET summonerstring summonerNameReturns are summoner's accountId, summonerId, account level, and profile icon id.
GET mastery_pagesint summonerIdSubsequent talent point entries for a specific summoner.
GET rune_pagesint summonerIdReturns for each specific summoner.
GET recent_gamesint accountIdReturns the statistics for a summoner's 10 most recent games.
GET summoner_namesCSV array summonerIdsThe summonerIds.
GET player_statsint accountId, string seasonThis is a summoner.
GET ranked_statsint accountId, string seasonStatistics for each champion summoner and season.
GET summoner_team_infoint summonerIdReturns all summoner has created.
GET in_progress_game_infostring summonerNameBans (if draft or ranked), and observer information.
GET teamstring teamIdReturns to the team, including the gameType-dependent history of statistics.
GET find_teamstring tagOrNameReturns to the team, including the gameType-dependent history of statistics.
GET team_end_of_game_statsstring teamId, double gameIdReturns very detailed statistics about the match.
GET team_ranked_statsstring teamIdReturns each team member. This call provides very similar results to getRankedStats.


There are also two Internal methods: GET items and GET champions. These methods are used without specifying a summoner region (api.elophant.com/v2/items?key=key). The first method returns a list of all game items, the second - a list of all characters.

Perhaps it is worth noting that within 15 minutes you can complete a maximum of 1000 queries.

That's all, See you in the Fields of Justice!

Source: https://habr.com/ru/post/166465/


All Articles