RiotAPI
A node.js library for fetching League of Legends data from the Riot API.
Riot's API requires a API Key. More information about how to get a Key, Rate Limits and more can be found on their official Site.
Game constants like queue types, maps, game types, game modes and rune slots are explained here.
Getting started
RiotAPI is designed to be simple.
var RiotApi = ;var api = 'YOUR_API_KEY_GOES_HERE';
Each Method takes an options object and a callback. The callback is always a json object, either a set of results or a status message if the call was invalid.
Methods
api.getChampions(options, callback)
Retrieve all champions currently in the game.
Options:
region
- string - Region where to retrieve the data. If no region is given,NA
will be used. Currently available regions are:NA
,EUW
,EUNE
.filter
- object - (Optional) Filter the result to only get Champions who match the specific options.active
- boolean - Indicates if the champion is active.rankedPlayEnabled
- boolean - Ranked play enabled flag.botEnabled
- boolean - Bot enabled flag (for custom games).botMmEnabled
- boolean - Bot Match Made enabled flag (for Co-op vs. AI games).freeToPlay
- boolean - Indicates if the champion is free to play. Free to play champions are rotated periodically.attackRank
- int - Champion attack rank.defenseRank
- int - Champion defense rank.difficultyRank
- int - Champion difficulty rank.magicRank
- int - Champion magic rank.id
- int - Champion ID.name
- string - Champion name.
Result:
The Result is a array of objects containing information about the champion. An object might look like this:
"botMmEnabled": false "defenseRank": 4 "attackRank": 8 "id": 266 "rankedPlayEnabled": true "name": "Aatrox" "botEnabled": false "difficultyRank": 6 "active": true "freeToPlay": false "magicRank": 3
Example:
api;
api.getRecentGames(options, callback)
Get the recent games for summoner.
Options:
region
- string - Region where to retrieve the data. If no region is given,NA
will be used. Currently available regions are:NA
,EUW
,EUNE
.summonerId
- int - Summoner ID*.summonerName
- string - Summoner Name*.
*Either Summoner ID or Name is required.
Result:
The Result is a object with informations about the recent games of the given summoner. The object is the exact same object given by the default API call, which can be tested here.
Example:
api;
api.getLeagues(options, callback)
Retrieves leagues data for summoner, including leagues for all of summoner's teams.
Options:
region
- string - Region where to retrieve the data. If no region is given,NA
will be used. Currently available regions are:NA
,EUW
,EUNE
,BR
,TR
.summonerId
- int - Summoner ID*.summonerName
- string - Summoner Name*.queue
- string - (Optional) Only recive data for the given queue type. Legal values are:RANKED_SOLO_5x5
,RANKED_TEAM_3x3
,RANKED_TEAM_5x5
.
*Either Summoner ID or Name is required.
Result:
The Result is a object with data about the leagues for the given summoner. The object is the exact same object given by the default API call (except if you only want to recieve a specific queue type), which can be tested here.
Example:
api;
api.getStatsSummary(options, callback)
Get player stats summaries for summoner.
Options:
region
- string - Region where to retrieve the data. If no region is given,NA
will be used. Currently available regions are:NA
,EUW
,EUNE
.summonerId
- int - Summoner ID*.summonerName
- string - Summoner Name*.season
- int - (Optional) If specified, stats for the given season are returned. Otherwise, stats for the current season are returned.
*Either Summoner ID or Name is required.
Result:
The Result is a object with data about the stats of summoner. The object is the exact same object given by the default API call, which can be tested here.
Example:
api;
api.getRankedStats(options, callback)
Get ranked stats for summoner. Includes statistics for Twisted Treeline and Summoner's Rift
Options:
region
- string - Region where to retrieve the data. If no region is given,NA
will be used. Currently available regions are:NA
,EUW
,EUNE
.summonerId
- int - Summoner ID*.summonerName
- string - Summoner Name*.season
- int - (Optional) If specified, stats for the given season are returned. Otherwise, stats for the current season are returned.
*Either Summoner ID or Name is required.
Result:
The Result is a object with data about the ranked stats of summoner. The object is the exact same object given by the default API call, which can be tested here.
Example:
api;
api.getMasteries(options, callback)
Get mastery pages for summoner.
Options:
region
- string - Region where to retrieve the data. If no region is given,NA
will be used. Currently available regions are:NA
,EUW
,EUNE
.summonerId
- int - Summoner ID*.summonerName
- string - Summoner Name*.
*Either Summoner ID or Name is required.
Result:
The Result is a object with data about the mastery pages of summoner. The object is the exact same object given by the default API call, which can be tested here.
Example:
api;
api.getRunes(options, callback)
Get rune pages for summoner.
Options:
region
- string - Region where to retrieve the data. If no region is given,NA
will be used. Currently available regions are:NA
,EUW
,EUNE
.summonerId
- int - Summoner ID*.summonerName
- string - Summoner Name*.
*Either Summoner ID or Name is required.
Result:
The Result is a object with data about the rune pages of summoner. The object is the exact same object given by the default API call, which can be tested here.
The runeSlotId
fields are explained here.
Example:
api;
api.getSummonerNamesByIds(options, callback)
Get list of summoner names by summoner IDs.
Options:
region
- string - Region where to retrieve the data. If no region is given,NA
will be used. Currently available regions are:NA
,EUW
,EUNE
.summonerIds
- array[int] - Summoner ID's.
Result:
The Result is an array with objects containing name and id of a summoner.
"id": 60783 "name": "TheOddOne" "id": 5908 "name": "Dyrus"
Example:
api;
api.getSummoner(options, callback)
Get basic information about summoner.
Options:
region
- string - Region where to retrieve the data. If no region is given,NA
will be used. Currently available regions are:NA
,EUW
,EUNE
.summonerId
- int - Summoner ID*.summonerName
- string - Summoner Name*.
*Either Summoner ID or Name is required.
Result:
The Result is an object containing basic information of a summoner.
"id": 60783 "name": "TheOddOne" "profileIconId": 558 "summonerLevel": 30 "revisionDate": 1386684611000 "revisionDateStr": "12/10/2013 02:10 PM UTC"
Example:
api;
api.getTeams(options, callback)
Retrieves teams of summoner.
Options:
region
- string - Region where to retrieve the data. If no region is given,NA
will be used. Currently available regions are:NA
,EUW
,EUNE
,TR
,BR
.summonerId
- int - Summoner ID*.summonerName
- string - Summoner Name*.
*Either Summoner ID or Name is required.
Result:
The Result is a object with data about the teams of summoner. The object is the exact same object given by the default API call, which can be tested here.
Example:
api;