# API streams commercial

**URL:** <https://staging-discuss.dev.twitch.com/t/api-streams-commercial/23152>\
**Category:** API\
**Created:** [November 16, 2019, 6:20pm UTC](https://staging-discuss.dev.twitch.com/t/api-streams-commercial/23152 "2019-11-16T18:20:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kobi](https://avatars.discourse-cdn.com/v4/letter/k/b3f665/32.png) [@kobi](https://staging-discuss.dev.twitch.com/u/kobi)\
**Post date:** [November 16, 2019, 6:20pm UTC](https://staging-discuss.dev.twitch.com/t/api-streams-commercial/23152/1 "2019-11-16T18:20:24Z")

</div>

#topic is solved and can get deleted

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [November 16, 2019, 6:25pm UTC](https://staging-discuss.dev.twitch.com/t/api-streams-commercial/23152/2 "2019-11-16T18:25:29Z")

</div>

Accept, client-id and authorization should be headers.

Length should be sent in the body as a JSON:

```auto
curl -H 'Accept: application/vnd.twitchtv.v5+json' \
-H 'Client-ID: uo6dggojyb8d6soh92zknwmi5ej1q2' \
-H 'Authorization: OAuth cfabdegwdoklmawdzdo98xt2fo512y' \
-H 'Content-Type: application/json' \
-d '{"length": 30}' \
-X POST 'https://api.twitch.tv/kraken/channels/44322889/commercial'

```

You seem to have set everything as query string arguments.

> **[Reference](https://dev.twitch.tv/docs/api/reference/)**
>
> Twitch Developer tools and services to integrate Twitch into your development or create interactive experience on twitch.tv.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://staging-discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [November 16, 2019, 7:13pm UTC](https://staging-discuss.dev.twitch.com/t/api-streams-commercial/23152/4 "2019-11-16T19:13:15Z")

</div>

Because you are sending them as post arguments instead of headers

> <https://stackoverflow.com/questions/29801195/adding-headers-when-using-httpclient-getasync>

```auto
client.DefaultRequestHeaders.Add("Accept", "application/*+xml;version=5.1");
client.DefaultRequestHeaders.Add("Authorization", "Basic " + authstring);

```

Seems to be the methods for setting headers

---

<div class="post-metadata">

**Author:** ![system](https://d2spem0quai2ol.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://staging-discuss.dev.twitch.com/u/system)\
**Post date:** [December 16, 2019, 7:32pm UTC](https://staging-discuss.dev.twitch.com/t/api-streams-commercial/23152/6 "2019-12-16T19:32:37Z")

</div>

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