Inconsistent results with /channels/channelName

Hey guys,

I was using this endpoint to check if a channel exists or not. I was using response.statusCode == 200 to verify that the channel existed, however sometimes I get a response of 400 for a channel that does exist, that has previously returned a 200!

Try refreshing this a bunch of times at different times of the day and you’ll see what i mean.

Sometimes I get this:

{“error”:“Bad Request”,“status”:400,“message”:“No client id specified”}

And other times I get what I expected.

I do not need to know if the channel is live or not, simply that it exists.

Will this be fixed, or is it the intended response? Anyone have a way to check if a channel exists that does not use this endpoint?

Don’t think I’ve been getting the error 400, as that pertains to Client ID not being included - have you checked your code to ensure you are always sending a Client ID with your API call?

Sometimes I’ll get a 404 but that’s not very often.

As for checking the stream on whether its live or not, the endpoint is:

The stream object will be null if the stream is offline - it will contain data if it is live.

200 is channel exists, 404 is channel deleted, 422 is a Justin tv account that wasn’t transferred, and 400 is an error in your request.

What language are you using? Are you dynamically generating the request or going through a single method?

I’m reproducing it in a browser by simply going here:

Try refreshing 20x 5 minutes apart and you’ll see. I’m using node, and I"m not doing the request wrong as it happens in the browser as well.

even if the browser I receive either this:

{“error”:“Bad Request”,“status”:400,“message”:“No client id specified”}

or a legit json block.

This might be a dumb question, but are you sending your client ID with the request as is now required?

There’s also /users/:username you can use to check if the account exists. In v3 of the API, this will only differ where the channel has a redirect (such as

3ventic, no, I was simply making an http request to the url I posted in the above reply. I didn’t realize I had to authenticate and use the api . I’ll try that thanks.

To avoid confusion twitch should ALWAYS respond with

{“error”:“Bad Request”,“status”:400,“message”:“No client id specified”}

when hitting it from a browser, instead of sometimes returning the proper information about the channel in json format. I went about a week with it returning it properly (since it randomly returns one or the other), which is what caused the confusion.

Right now it’s returning:

{“mature”:null,“status”:" High Stakes Poker “,“broadcaster_language”:“en”,“display_name”:“highstakespoke”,“game”:“Poker”,“language”:“en”,”_id":140315380,“name”:“highstakespoke”,“created_at”:“2016-11-25T12:10:50Z”,“updated_at”:“2016-12-29T17:05:43Z”,“delay”:null,“logo”:“",“banner”:null,“video_banner”:null,“background”:null,“profile_banner”:“”,“profile_banner_background_color”:null,“partner”:false,“url”:“”,“views”:75452,“followers”:2244,"_links":{“self”:“”,“follows”:“”,“commercial”:“”,“stream_key”:“”,“chat”:“”,“subscriptions”:“”,“editors”:“”,“teams”:“”,“videos”:"”}}

In case it helps anyone, changing it to this works:

twitch.getChannel('highstakespoke', function(err, results) {
    if(err) console.log(err);

But if you do this:

    url: '' + '/highstakespoke', 
    json: true
}, function(err, response, body) {
    if(err) console.log(err);

You will get 200 and 400 randomly.

It should always return 400 without a client ID, and I can’t repro what you’re seeing; I always get 400 without the client ID. A regional bug perhaps? cc @DallasNChains

It’s random. You’d have to try it at different points in the day. I went a whole week without getting a 400 once, which is how I got into this mess in the first place. :slight_smile:

I agree it should always return 400.

Do you have logs of your request and response times where this is happening, @drivealiveapp? It definitely should always return a 400 without a Client-ID since all of that is centralized across the API. I can’t reproduce this particular behavior right now.

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