Multiple streams JSON url

I’m new to JavaScript, and new to the Twitch API, so I apologize if this has already been asked.

I’m using the following url to get stream information as JSON. It works for one user, but if I try to get JSON for multiple users by separating the user id’s by commas, it does not work.

For example, this works (request one user’s stream):

var url = "https://api.twitch.tv/kraken/streams/ESL_SC2?client_id=uoxr3607rgh8dhn3ybwc0lnd2ikltx";

$.getJSON(url, function(response) {
console.log(response);
  }

But this does not (requesting more than one user’s stream):

var url = "https://api.twitch.tv/kraken/streams/ESL_SC2,OgamingSC2?client_id=uoxr3607rgh8dhn3ybwc0lnd2ikltx";

$.getJSON(url, function(response) {
console.log(response);
  }

Is there a way I can return JSON for more than one stream in one url? I’d like to do it for about 9 or 10 streams total. Thanks for any ideas.

The correct format for the url is:

https://api.twitch.tv/kraken/streams?channel=ESL_SC2,OgamingSC2&client_id=uoxr3607rgh8dhn3ybwc0lnd2ikltx
1 Like

Got it, thank you

EDIT:
On checking this a second time, that url seems to be returning 25 random streams, and not the streams I specify in the url. None of the 25 are even from the users I specify in the url. Any ideas?

https://api.twitch.tv/kraken/streams?channels=ESL_SC2,OgamingSC2&client_id=uoxr3607rgh8dhn3ybwc0lnd2ikltx

Try ?channel= (no s)

1 Like

Thanks for your response. I tried plugging that in in a few locations in the url and it doesn’t seem to be working.

@orange This works for me and only gets the two channels: https://api.twitch.tv/kraken/streams?channel=ESL_SC2,OgamingSC2&client_id=uoxr3607rgh8dhn3ybwc0lnd2ikltx

1 Like

Yup, you’re right. Thanks @DallasNChains and @george.

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