# Code 300, unsupported content type

**URL:** <https://devforum.zoom.us/t/code-300-unsupported-content-type/87102>\
**Category:** API and Webhooks\
**Tags:** api\
**Created:** [April 20, 2023, 2:06pm UTC](https://devforum.zoom.us/t/code-300-unsupported-content-type/87102 "2023-04-20T14:06:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pascal.ney](https://avatars.discourse-cdn.com/v4/letter/p/aca169/32.png) [@pascal.ney](https://devforum.zoom.us/u/pascal.ney)\
**Post date:** [April 20, 2023, 2:06pm UTC](https://devforum.zoom.us/t/code-300-unsupported-content-type/87102/1 "2023-04-20T14:06:17Z")

</div>

Hello,  
I am trying to build a chat application on a website with the zoom api.  
When I try to post a message I get the following answer:

```auto
{"code":300,"message":"Unsupported Content Type"}

```

get requests work just fine. Also there are no issues with posting in postman.  
This is my post request:

```auto
this.api
        .post('chat/users/me/messages/', body)
        .then((response) => console.log(response))

```

with the body being:

```auto
let body = JSON.stringify({
        message: event.detail[0].content,
        channel_id: this.curRoom.zoom_id
      })

```

And here I set my headers with Authentication:

```auto
this.api = axios.create({
        baseURL: baseURL,
        headers: {
          Authorization: `Bearer ${this.accessToken}`
        }
      })

```

As I said, get requests work, but if I try said post request  
I always get code 300 in the answer and Error 415: “Unsupported Media Type” in the browser.  
I would appreciate any help on that topic, since I am very new to working with APIs.

---

<div class="post-metadata">

**Author:** ![MultiplayerSession](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/multiplayersession/32/66446_2.png) [@MultiplayerSession](https://devforum.zoom.us/u/MultiplayerSession)\
**Post date:** [April 20, 2023, 2:22pm UTC](https://devforum.zoom.us/t/code-300-unsupported-content-type/87102/2 "2023-04-20T14:22:36Z")

</div>

If you include a body (which is something that the HTTP `POST` method expects you to do), you should add the `Content-Type` header to indicate how to interpret the body. For Zoom APIs, you’ll typically use `application/x-www-form-urlencoded; charset=utf-8` or `application/json; charset=utf-8` depending on whether you format the body as a query string or as JSON. I don’t see an explicit content type specified, so maybe there is a default value being sent that doesn’t match the JSON you’re sending.

---

<div class="post-metadata">

**Author:** ![pascal.ney](https://avatars.discourse-cdn.com/v4/letter/p/aca169/32.png) [@pascal.ney](https://devforum.zoom.us/u/pascal.ney)\
**Post date:** [April 21, 2023, 6:54am UTC](https://devforum.zoom.us/t/code-300-unsupported-content-type/87102/3 "2023-04-21T06:54:02Z")

</div>

Hi, I already tried it with application/json as follows:

```auto
await this.api
        .post('chat/users/me/messages/', body, {
          headers: {
            'content-type': 'application/json'
          }
        })

```

In my browser it even says. that `content-type:application/json` is set.  
I need it to work with json, but I don’t know what the issue is.

---

<div class="post-metadata">

**Author:** ![MultiplayerSession](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/multiplayersession/32/66446_2.png) [@MultiplayerSession](https://devforum.zoom.us/u/MultiplayerSession)\
**Post date:** [April 21, 2023, 1:18pm UTC](https://devforum.zoom.us/t/code-300-unsupported-content-type/87102/4 "2023-04-21T13:18:07Z")

</div>

Have you checked the [API Call Logs](https://marketplace.zoom.us/user/logs) to compare what Zoom receives for your successful and failing calls? That might help quickly narrow down the differences without having to connect a web traffic proxy debugger like Fiddler to audit what’s being sent from your web server.

---

<div class="post-metadata">

**Author:** ![pascal.ney](https://avatars.discourse-cdn.com/v4/letter/p/aca169/32.png) [@pascal.ney](https://devforum.zoom.us/u/pascal.ney)\
**Post date:** [April 25, 2023, 10:26am UTC](https://devforum.zoom.us/t/code-300-unsupported-content-type/87102/5 "2023-04-25T10:26:06Z")

</div>

I have checked it right now. Apparently the zoom api does not support content-type: x-www-form-urlencoded . I have tried it in Postman and got Error 415. Also for some reason I cannot change the content-type in my code. If I try `let body = JSON.stringify({  
message: event.detail[0].content,  
to\_channel: this.curRoom.zoom\_id  
})

```
  await this.api
    .post('chat/users/me/messages', body, {
      headers: {
        'content-type': 'application/json'
      }
    })
    .then((response) => console.log(response))`

```

, the zoom API just returns:

```auto
{
"endpoint": "https://api.zoom.us/v2/chat/users/me/messages",
"response_headers": [
"Set-Cookie: zm_aid=""; Domain=.zoom.us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly"
],
"date_time": "2023-04-25 12:22:35",
"method": "POST",
"request_body": "N/A",
"response": {
"code": 300,
"message": "Unsupported Content Type"
},
"request_headers": [
"accept-encoding: gzip",
"accept: application/json, text/plain, */*",
"authorization: ******",
"connection: close",
"content-type: application/x-www-form-urlencoded",
"user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.58"
],
"request_params": [
],
"http_status": "415"
}.
As you can see, apparently the content-type is not being set correctly, and I do not know how to fix this.

```

---

<div class="post-metadata">

**Author:** ![pascal.ney](https://avatars.discourse-cdn.com/v4/letter/p/aca169/32.png) [@pascal.ney](https://devforum.zoom.us/u/pascal.ney)\
**Post date:** [April 25, 2023, 10:27am UTC](https://devforum.zoom.us/t/code-300-unsupported-content-type/87102/6 "2023-04-25T10:27:12Z")

</div>

> [@pascal.ney](#):
>
> ```auto
> .
> As you can see, apparently the content-type is not being set correctly, and I do not know how to fix this.
> 
> ```

Accidentally slipped into the code section ^^

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [April 28, 2024, 2:03am UTC](https://devforum.zoom.us/t/code-300-unsupported-content-type/87102/7 "2024-04-28T02:03:28Z")

</div>

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