# API Stream Query

**URL:** <https://discuss.dev.twitch.com/t/api-stream-query/7750>\
**Category:** API\
**Created:** [October 9, 2016, 7:32am UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750 "2016-10-09T07:32:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Straconis](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Straconis](https://discuss.dev.twitch.com/u/Straconis)\
**Post date:** [October 9, 2016, 7:32am UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750/1 "2016-10-09T07:32:57Z")

</div>

I’m trying to perform a call to get the response to tell if the channel is live or not.  
The code so far appears as:

```auto
<script src="/script/jquery-1.11.3.min.js"></script>
<script>
console.log("Begin Script");
$.ajax(
{
	dataType: "jsonp",
	url: "https://api.twitch.tv/kraken/streams/straconischannel",
	success: function(channel)
	{
		console.log("Results:");
		console.log(channel);
	},
	error: function(){
	    console.log("The Request Failed");
	}
	
});
console.log("End Script");
</script>
```

The Jquery file is located in the location specified.  
The result that returns is {“error”:“Bad Request”,“message”:“No client id specified”,“status”:400}

This is the same response that returns when running the Example Request from the API documentation in bash. ![](https://d2opxh93rbxzdn.cloudfront.net/original/2X/6/694939f16ace801f8e21d4a73e3765f1c868c2aa.png)

---

<div class="post-metadata">

**Author:** ![Muddr](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/muddr/32/1877_2.png) [@Muddr](https://discuss.dev.twitch.com/u/Muddr)\
**Post date:** [October 9, 2016, 8:34am UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750/2 "2016-10-09T08:34:02Z")

</div>

Client ID’s are required for almost all API calls now.

> [@Client-ID Requirement FAQs](https://discuss.dev.twitch.com/t/client-id-requirement-faqs/6108):
>
> In case you missed it, the Kraken API will require a Client-ID as of August 8th, 2016. [Read the blog](https://blog.twitch.tv/client-id-required-for-kraken-api-calls-afbb8e95f843) for more details. Here are a few FAQs that I thought I’d address in one place: Is the Client-ID required for all API calls? Yes! Every API call, no matter how simple, will require the Client-ID in the header. If I’m including an OAuth token, do I need to include a Client-ID? If you are passing in an OAuth token, we will figure out the Client-ID for you. Are query string parameters still supp…

---

<div class="post-metadata">

**Author:** ![Straconis](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Straconis](https://discuss.dev.twitch.com/u/Straconis)\
**Post date:** [October 9, 2016, 4:21pm UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750/3 "2016-10-09T16:21:42Z")

</div>

Using that information I’ve made it further, but I’m not sure what to do from here.

 ![](https://d2opxh93rbxzdn.cloudfront.net/original/2X/d/d437dcb267fc708f8ebacab9bc5dc1047daa572d.png)

---

<div class="post-metadata">

**Author:** ![Larklen](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/larklen/32/2138_2.png) [@Larklen](https://discuss.dev.twitch.com/u/Larklen)\
**Post date:** [October 9, 2016, 5:01pm UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750/4 "2016-10-09T17:01:09Z")

</div>

Try removing the “?oauth\_token=” portion, so your URL should just be

> [https://api.twitch.tv/kraken/streams/straconischannel](https://api.twitch.tv/kraken/streams/straconischannel)

OAUTH\_Token is unnecessary in this case, though I’d still expect it to work since the client ID is being identified. If you still receive errors, then please list what error you are seeing.

---

<div class="post-metadata">

**Author:** ![Straconis](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Straconis](https://discuss.dev.twitch.com/u/Straconis)\
**Post date:** [October 9, 2016, 5:22pm UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750/5 "2016-10-09T17:22:54Z")

</div>

There is still an error without the OAUTH\_token, without it I still get the Bad Request for no client ID.

 ![](https://d2opxh93rbxzdn.cloudfront.net/original/2X/3/36c37885dd5a31f556e2ea9746087ea7b3c23d27.png)

---

<div class="post-metadata">

**Author:** ![Larklen](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/larklen/32/2138_2.png) [@Larklen](https://discuss.dev.twitch.com/u/Larklen)\
**Post date:** [October 9, 2016, 5:31pm UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750/6 "2016-10-09T17:31:20Z")

</div>

I tried out the jQuery AJAX example in the blog and it worked as expected for me - the only real difference I see between your code and the code example is your example does not specify:

> type: “GET”,

unfortunately I am not well-versed in AJAX so my help may be limited - try adding that identifier prior to your dataType: and see if that resolves your issue.

---

<div class="post-metadata">

**Author:** ![Straconis](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@Straconis](https://discuss.dev.twitch.com/u/Straconis)\
**Post date:** [October 9, 2016, 5:36pm UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750/7 "2016-10-09T17:36:38Z")

</div>

With your assistance I got it working, I was too close to the problem to see it. It wasn’t just the missing GET command, it was the included datatype command that was causing an issue. After these two changes the code is now working. Thank you.

---

<div class="post-metadata">

**Author:** ![Larklen](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/larklen/32/2138_2.png) [@Larklen](https://discuss.dev.twitch.com/u/Larklen)\
**Post date:** [October 9, 2016, 5:41pm UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750/8 "2016-10-09T17:41:16Z")

</div>

Glad to hear it’s now working! 🙂

---

<div class="post-metadata">

**Author:** ![3ventic](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/3ventic/32/298_2.png) [@3ventic](https://discuss.dev.twitch.com/u/3ventic)\
**Post date:** [October 10, 2016, 4:00am UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750/9 "2016-10-10T04:00:19Z")

</div>

jsonp does not support modified headers, you should use json instead.

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [November 9, 2016, 4:00am UTC](https://discuss.dev.twitch.com/t/api-stream-query/7750/10 "2016-11-09T04:00:20Z")

</div>

Closed on November 9, 2016, 4:00am UTC

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