Can't GET a specific stream by ID

curl -H "Client-ID: " -H ‘Accept: application/vnd.twitchtv.v5+json’ -X GET ‘https://api.twitch.tv/kraken/streams/?limit=1

This returns the below. All well and good.

{
    "_total":27568,
    "streams":[
        {
            "_id":24260093376,
            .  
            .
            .
            "channel":
                {
                    .
                    .
                    .
                }
        },
        {
            .
            .
            .
        }
    ]
}'

But if I take this ID, changing the url to ‘https://api.twitch.tv/kraken/streams/24260093376’, I get this.

{
  "stream":null
}

And I know that’s the response if they’re offline. However, I’ve double checked they are online before and after, and have received the same response each time. Am I doing something wrong? The docs say the proper request is -X GET ‘https://api.twitch.tv/kraken/streams/7236692’ which I am doing.

You need to use the channel ID, not stream ID.

Oh, I thought that was the same ID. Can I get the channel ID from the /streams query in any way without having to do a separate call on the streamers name?

It’s right there in the channel object

What 3ventic said. Also something to note, the channel ID and user ID are the same, so those can be used interchangeably wherever needed.

dear lord. I looked at the whole object for so freaking long and never saw the _id in the channel object. I saw it in the streams object… thank you.

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