No matter what stream I’m trying to reach, I always get a null answer… I´ve tried various channels that are supposed to stream 24/7 but the answer is always the same: null.
So I’m first calling at the channel to get the id and then I use that id to get the stream status.
Here are the request I’m making:
What am I doing wrong?!
I think you’re mixing up v3 and v5 of the API.
v3 requires channel/user names and v5 requires IDs
Since you’re not stating which one you’re using I assume it’s v3. So this should work just fine
The API currently defaults to v3, which uses usernames instead a channel id, so when you’re calling the streams endpoint with an id the API is looking for a channel where the username matches that id, which it doesn’t and so returns null streams. If you add
api_version=5 to the querystring, or
Accept: application/vnd.twitchtv.v5+json as a header in the request it should give you the response you are looking for.
Also, to get the id of a channel in the first place there is a page in the docs https://dev.twitch.tv/docs/v5/guides/using-the-twitch-api#translating-from-user-names-to-user-ids that explains how to translate a username to ID with the v5 API.
You guys are lifesavors!
At first I had my header right but I don’t know why, I ended up without.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.