js server running some basic api calls from riot.developer. I'm planning on having the match history and stats for each summoner/game available. For this I assume I need the match id's.
I've got a couple of the calls working but seem to have hit a block with this one. Probably staring at my screen for too long! Here is my code for the specific request, for clarity, this request is only for the match id's:
function(data, callback) {
var URL = 'https://euw.api.pvp.net/api/lol/euw/v2.2/matchlist/by-summoner/' + data.id + 'seasons=SEASON2016&beginIndex=0&endIndex=40&api_key=' + api_key;
request(URL, function (err, response, body) {
if (response.statusCode == 200) {
var json = json.parse(body);
var matchId = 0;
for (var c = 0; c < json['matches'].length; c++) {
data.matches = json['matches'].matchId;
data.matches = matchId;
console.log(data.matches);
callback(null, data);
}
} else {
console.log('line 82');
}
});
},
I think the problem I'm having is with the way I'm expressing data.matches
. Or that there isn't a timeline?
data.id
and api_key
are defined outside of this function and are working correctly.
Anyway, thanks for any help you guys might be able to provide.
I should probably mention i have express-handlebars installed.