Skip to content
Advertisement

how to find out online of streamer via http get request twitch

Hello everyone! I need to send http get request to twitch API. How it works: User inputs name of the streamer, my programm sends http get request to twitch API and the output need to be how much viewers right now on the twitch stream. my try:

JavaScript

Advertisement

Answer

I recommend that you use a package like axios to make your request. That is because to authenticate you need to send a POST requeust as well which axios makes very easy.

First you need to authenticate to the server this can be done like so

JavaScript

You can query for a channel like this. You can find all request you can make and their response here. Again here you need to provide the authentication from the previous step

JavaScript

For the example you provided it would look like this (you did not include the Bearer Prefix

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement