Searching paginated results from the Twitch API

I’m trying to get all the games from the twitch API and be able to search through them so far I have done this:

var games = [];

$.ajax({
url: 'https://api.twitch.tv/helix/games/top',
headers: {
    'Client-ID':'xxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type':'application/json'
},
method: 'GET',
dataType: 'json',
success: function(data){
  games.push(data.data)
}
});

$(document).ajaxComplete(function() {
  var search = "Counter-Strike".toLowerCase();
  var results = games[0].filter(function(data) {
return data.name.toLowerCase().indexOf(search) > -1;
  });
  console.log(results);
});

Now how do I use pagination to get the rest of the games and save them in the game’s array? by the way, is it allowed to get so much data?

Pagination is paginated using the after query string argument.

basically yes, just abide by the terms of the Developer Agreement and the documented rate limits

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.