Returning nothing when calling twitch API

Returning nothing when calling twitch API
0

#1

alright so as the title states, im not getting anything returned when im calling twitch streams, even when i paste the url into a different browser, nothing… getting really frustrated

$(document).ready(function() {
var name = [“ESL_SC2”, “OgamingSC2”, “cretetion”, “freecodecamp”, “storbeck”, “habathcx”, “RobotCaleb”, “noobs2ninjas”]

$.getJSON("https://api.twitch.tv/kraken/streams/freecodecamp?callback=?"

)
.done(update)
function update(data){
$("#body").html((data.stream.channel.url));
}

});

and the weirdest thing is this was working a couple of days ago… its really giving me a headache.

https://api.twitch.tv/kraken/streams/freecodecamp?callback=?
returns nothing when pasted on a different tab… AHH!!! please help!


#2

Hey, it does work, but you try to acces data.stream.channel.url, but this property is only set when the channel is streaming. Tip: always check the console for error messages.


#3

that was working a few days ago, it was returning the users url…
and when i copy paste https://api.twitch.tv/kraken/streams/freecodecamp?callback=?

onto a different tab nothing comes out… :confused: so i cant see the object tree anymore


#4

If you try it in a browser, remove the “callback=?” part.


#5

i get this error

Failed to load resource: the server responded with a status of 400 (Bad Request)
when i try it on a different tab

if i remove the callback=? part its pretty much useless i just get the self and channel link


#6

and if you look at the example pen

they use the same api call im using, and when you try to copy paste that one onto a browser it doesnt work either lol

this is so confusing


#7

Yeah, that’s the idea. If the channel isn’t streaming it will return only self and channel.


#8

Try this in your browser: https://api.twitch.tv/kraken/streams/esl_sc2

He/she is streaming now.


#9

the thing is, when you replace with a live streaming one such as

https://api.twitch.tv/kraken/streams/ESL_SC2?callback=?

nothing happens either


#10

whoa that worked!

wait i think im messsing up on the names, are they all supposed to be lower case?


#11

Seems like it isn’t case sensitive.

Nope doesn’t matter.


#12

This won’t help solve your current problem, but here’s as an FYI that can prevent future problems, you are going to need a clientID to make API calls in the near future.


#13

thats so weird ! a while ago i wasnt getting anything… does that mean they barely started streaming?


#14

@PortableStick
isnt that only for certain websites though?


#15

Nope!

TL;DR: On Monday, August 8th, 2016, we’re going to really-for-real require the Client-ID header on all of your API requests to Kraken.


#16

is there a page i can see to learn how to set up the client id? haha sorry im a noob


#17

Yup! The very link I just posted has instructions on how to get the ClientID from Twitch.


#18

Thanks guys!!! really appreciate your time and patience