New TwitchTV API response


I am trying to get information about streams by user_id, and what ever the user_id I am getting the same response from the API:

      "data": [],
      "pagination": {}

Can anyone give me a hint why this happening??


Can you post your full request?

1 Like

Is the channel that you’re requesting stream data for online? Because if the channel is offline then there is no stream object, so an empty data array is expected. If you’re sure the channel is online then as Six asked, we’ll need to see the full request you’re making.

1 Like

@Six here is my full request:

var twitchAPI = $.ajax({
        type: "GET",
        url: "",
        // contentType: ('application/x-www-form-urlencoded; charset=UTF-8'),
        crossDomain: true,
        headers: {
            "Client-ID": "5k4g3q59o69v6p9tudn39v50ro1mux",
        dataType: "json",
        success: function (json) {
            console.log(JSON.stringify(json, null, 2));
        error: function () {

@Dist: one of the channels is ESL_SC2 which is streaming 24/7.

user_id requires the actual channel id, not username.

You are passing logins instead of user_id's. Change your request to use login= and it should work.


As an additional note, if you do want to pass user id’s, then you would do id= instead of user_id=.


Thanks a lot :slight_smile: it is finally working. But it seems if a channel is offline, nothing is returned by the API, not even something like:

       type: offline

Yep, this is the intended behavior of the API. Any stream that is not live will be ignored and not returned in the response. So if none of the requested streams are live, the data will be an empty array.

1 Like

Okay I understand :sweat_smile: thanks again for your help :slight_smile:

1 Like

No problem :smiley:

I believe you are confusing the streams endpoint with the users endpoint. Streams uses user_id and user_login, as it also accepts game and community ID parameters which is why when searching based on user it uses that longer form. Where as the users endpoint doesn’t have that risk of ambiguity so just has id and login.


Ah yeah, my bad. I derped.

1 Like

@Dist thanks for the clarification. this should be very helpful for my project :slight_smile:

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