Search query URL

I’m using Javascript AJAX call to hit this Twitch API search query URL: https://api.twitch.tv/kraken/search/streams?q=starcraft

$.ajax({
type: ‘GET’,
url: ‘https://api.twitch.tv/kraken/streams?q=starcraft’,
headers: {‘Client-ID’: ‘xxx’},
success: function (json) {
arrStreams.push(json.streams);
}

However, I’m not sure I completely understand the premise of the ?q query search URL. This URL returns a total of around 20,000 entries that not only stream “starcraft”, but a bunch of other games. I assumed at first it was taking “starcraft” as a broad keyword, but when I switch the URL to url: https://api.twitch.tv/kraken/streams?q=runescape OR EVEN url: https://api.twitch.tv/kraken/streams?q= it returns the same object with the same number of results…

The documentation says the ?q URL “returns a list of channel objects matching the search query”, but I don’t see how it’s behaving this way. How come I get the same object of “Object {_total: 21324, streams: Array[25], _links: Object}” every single time I call a search query of any game?

Your url is incorrect, you’re missing /search from it. Therefore the api is returning a list of all streams…

https://api.twitch.tv/kraken/search/streams?q=starcraft

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