# Searching paginated results from the Twitch API

**URL:** <https://discuss.dev.twitch.com/t/searching-paginated-results-from-the-twitch-api/20142>\
**Category:** API\
**Created:** [February 21, 2019, 4:54pm UTC](https://discuss.dev.twitch.com/t/searching-paginated-results-from-the-twitch-api/20142 "2019-02-21T16:54:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harry\_Banda](https://avatars.discourse-cdn.com/v4/letter/h/8dc957/32.png) [@Harry\_Banda](https://discuss.dev.twitch.com/u/Harry_Banda)\
**Post date:** [February 21, 2019, 4:54pm UTC](https://discuss.dev.twitch.com/t/searching-paginated-results-from-the-twitch-api/20142/1 "2019-02-21T16:54:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [February 21, 2019, 5:00pm UTC](https://discuss.dev.twitch.com/t/searching-paginated-results-from-the-twitch-api/20142/2 "2019-02-21T17:00:48Z")

</div>

Pagination is paginated using the `after` query string argument.

> [@Harry\_Banda](#):
>
> is it allowed to get so much data?

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

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [March 23, 2019, 5:00pm UTC](https://discuss.dev.twitch.com/t/searching-paginated-results-from-the-twitch-api/20142/3 "2019-03-23T17:00:49Z")

</div>

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