GET issues: Can't get my headers to work

Hello.
I’ll try and keep it short.

I need to add “limit” as a header to “GET https://api.twitch.tv/kraken/streams/followed”, but if I do, it’s still limited to the default 25. The “offset” header has no effect either…
I’m not sure what I’m doing wrong :confused:
I’ve used multiple languages, but get the same result…

Any and all help is appreciated. New to the forums, so excuse the messy post.

Python code:

address = ‘https://api.twitch.tv/kraken/streams/followed
headers = {
‘Cache-Control’: ‘no-cache’,
‘Accept’: ‘application/vnd.twitchtv.v5+json’,
‘Client-ID’: ‘xxxxxxx’,
‘Authorization’: ‘OAuth xxxxxxx’,
‘offset’: “50”,
‘stream_type’: ‘live’
}
get = requests.get(address, headers=headers)
file = open(“jsincoming.txt”, “w”, encoding=“utf-8”)
file.write(get.text)
file.close()

It returns only 25 live streamers, even though at the top of the json response, it says ’ {"_total":39 ’

I get the same result in C#

var httpWebRequest = (HttpWebRequest)WebRequest.Create(“https://api.twitch.tv/kraken/streams/followed”);
httpWebRequest.Accept = “application/vnd.twitchtv.v5+json”;
httpWebRequest.Method = “GET”;
httpWebRequest.Headers.Add(“Client-ID”, “xxxxxxx”);
httpWebRequest.Headers.Add(“Authorization”, “OAuth xxxxxxx”);
httpWebRequest.Headers.Add(“limit”, “50”);
httpWebRequest.Headers.Add(“stream_type”, “live”);

var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var answer = JsonConvert.DeserializeObject(streamReader.ReadToEnd());
Console.Write(answer);
}

limit/offset and stream_type are not header values.

they are query string params

1 Like

Brilliant. You solved my issue completely…
New to the whole API thing, and didn’t realise you’d add those somewhere like here:

address = ‘https://api.twitch.tv/kraken/streams/followed?limit=100

Thanks a ton!

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