How to get get multiple streams with user login in 1 request?

https://api.twitch.tv/helix/streams?user_login=user1

Above is how to get info about user1.

On twitch api it says Returns streams broadcast by one or more specified user login names. You can specify up to 100 names, but there are not examples provided.

I tried below, but nothing works.:

Since you are requesting the streams endpoint, the channels you’re checking have to be currently live.

The 3rd url you attempted is the correct answer, just ensure that everyone listed is live or you’ll get a blank response in place of a real result.

The following code (in jQuery) works just fine for me.

var clientId = "your-client-id";

$.ajax({
  url: "https://api.twitch.tv/helix/streams?user_login=EatMyDiction1&user_login=manvsgame",
  method: "GET",
  headers: {
   "Client-ID": clientId
  }
});

So if I check for multiple streamers all have to be live?

I can’t check for (example) 5 streams to see which are live? I have to make request for each stream separately?

No you do not need to request each stream separately.

You can still do

https://api.twitch.tv/helix/streams
?user_login=streamer1
&user_login=streamer2
&user_login=streamer3
&user_login=streamer4

However if streamer2 is offline, and the rest are online, you will get 3 objects.

// This is not the exact response
[
  {
    "name": "streamer1"
  },
  {
    "name": "streamer3"
  },
  {
    "name": "streamer4"
  },
]

So you need to loop through the results to see who is online and who isn’t.

1 Like

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