Twitch API: 1 request for multiple channels?


#1

Is there a way to structure the http request to get json for more than one channel? Then I could avoid multiple requests. (Can’t find answer in the documentation or google searches.)


#2

I don’t know that there is a way to do it, at least with the twitch API. Is there a reason you need to avoid multiple requests? On my project, I used a callback function to get all my streamers and it worked fine.


#3

No, I can do multiple requests. It seemed like there should be a way to get back more than one, since wikipedia provided a way. Thanks for responding. I’ll go ahead and finish it now.


#4

If you use the actual Twitch API, you can send a comma-separated list of streamers in your API Call. The Free Code Camp mirror at wind-bow.glitch.me does not allow that functionality.

https://dev.twitch.tv/docs/v5/reference/streams/#get-live-streams

The URL would look like:

"https://api.twitch.tv/kraken/streams?channel=streamer1,streamer2,streamer3,streamer4&client_id=<<your client ID>>"

FWIW, I think a (helpful) learning experience in this challenge is looping through an array of users and making multiple API calls. It forces us to better understand the asynchronous nature of JavaScript.