# Getting info from API (simple)

**URL:** <https://discuss.dev.twitch.com/t/getting-info-from-api-simple/2066>\
**Category:** API\
**Created:** [April 19, 2015, 2:52pm UTC](https://discuss.dev.twitch.com/t/getting-info-from-api-simple/2066 "2015-04-19T14:52:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PatrickRorth](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/patrickrorth/32/4353_2.png) [@PatrickRorth](https://discuss.dev.twitch.com/u/PatrickRorth)\
**Post date:** [April 19, 2015, 2:52pm UTC](https://discuss.dev.twitch.com/t/getting-info-from-api-simple/2066/1 "2015-04-19T14:52:30Z")

</div>

So I’m new to twitch API, and been playing around with it a bit and got a little hang to it.  
Altho im trying to load all the games, like “browse” on the site it self. But i cant seem to get it to work.

Can some one help me on this please?

SO far, i can load one game, with all the pictures. I want all games, and with the medium picture.

This is how far I’ve gotten:

```
$.ajax({
url: 'https://api.twitch.tv/kraken/games/top',
type: 'GET',
contentType: 'application/json',
dataType: 'jsonp',
success: function(data) {
	            	
$.each(data.top[0].game.box, function(index, value){
   //console.log("AJAX " + data.top[1].game.name);
   console.log("ID: " + index + value);

   $(".twitch-widget").append("<img src='" + value + "'>");
   		
   })          
 }
});
```

---

<div class="post-metadata">

**Author:** ![Gertulio](https://avatars.discourse-cdn.com/v4/letter/g/41988e/32.png) [@Gertulio](https://discuss.dev.twitch.com/u/Gertulio)\
**Post date:** [April 19, 2015, 11:09pm UTC](https://discuss.dev.twitch.com/t/getting-info-from-api-simple/2066/2 "2015-04-19T23:09:55Z")

</div>

Hi I’m also strarting to use the API. Can you clarify me what stands the index for?

---

<div class="post-metadata">

**Author:** ![Fugiman](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/fugiman/32/108_2.png) [@Fugiman](https://discuss.dev.twitch.com/u/Fugiman)\
**Post date:** [April 19, 2015, 11:33pm UTC](https://discuss.dev.twitch.com/t/getting-info-from-api-simple/2066/3 "2015-04-19T23:33:25Z")

</div>

Take a look at what you’re iterating over. `$.each(data.top[0].game.box` says “Take the top game, iterate over it’s boxart, and do something with each url”. You likely want `$.each(data.top` which says “Iterate over the top games”. Then you’d get the boxart with `value.game.box.medium`.

---

<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:** [May 19, 2015, 11:33pm UTC](https://discuss.dev.twitch.com/t/getting-info-from-api-simple/2066/4 "2015-05-19T23:33:37Z")

</div>

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