# "error" : "Content-Type header \[application/x-www-form-urlencoded\] is not supported",

**URL:** <https://discuss.elastic.co/t/error-content-type-header-application-x-www-form-urlencoded-is-not-supported/231849>\
**Category:** Elasticsearch\
**Created:** [May 9, 2020, 3:07pm UTC](https://discuss.elastic.co/t/error-content-type-header-application-x-www-form-urlencoded-is-not-supported/231849 "2020-05-09T15:07:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![joaopedro](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@joaopedro](https://discuss.elastic.co/u/joaopedro)\
**Post date:** [May 9, 2020, 3:07pm UTC](https://discuss.elastic.co/t/error-content-type-header-application-x-www-form-urlencoded-is-not-supported/231849/1 "2020-05-09T15:07:52Z")

</div>

I'm new to elasticsearch, this is literally my first cluster. I am using Windows 10 and was trying to run the following at the command line:

```auto
C:\elastic>curl -X POST "localhost:9200/students/student/1?pretty" -d '{"joao":"pedro","bob":"michael"}'

```

And I got the following output:

```auto
{
  "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
  "status" : 406
}

```

After a little of research, I tried the following:

```auto
curl -XPOST "localhost:9200/students/student/1?pretty" -H'Content-Type: application/json' -d '{"joao":"pedro","bob":"michael"}'

```

And I got the following output:

```auto
{
  "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
  "status" : 406
}
curl: (6) Could not resolve host: application

```

How the heck I resolve this problem? Anyone known ANYTHING about it?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 9, 2020, 3:20pm UTC](https://discuss.elastic.co/t/error-content-type-header-application-x-www-form-urlencoded-is-not-supported/231849/2 "2020-05-09T15:20:40Z")

</div>

Welcome!

Windows is a pain when it comes to curl. You should better use Kibana.

Have a look at this: [Content-Type header [application/x-www-form-urlencoded] is not supported, "status":406](https://discuss.elastic.co/t/content-type-header-application-x-www-form-urlencoded-is-not-supported-status-406/229528/4)

---

<div class="post-metadata">

**Author:** ![joaopedro](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@joaopedro](https://discuss.elastic.co/u/joaopedro)\
**Post date:** [May 9, 2020, 3:52pm UTC](https://discuss.elastic.co/t/error-content-type-header-application-x-www-form-urlencoded-is-not-supported/231849/3 "2020-05-09T15:52:40Z")

</div>

Thank you for the suggestion! But I am still going to search for someway of resolve using curl, I have seen 3 tutorials of people using curl and working perfectly.

I just don't understand wtf is happening with my computer. Even so, thanks very much!

---

<div class="post-metadata">

**Author:** ![joaopedro](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@joaopedro](https://discuss.elastic.co/u/joaopedro)\
**Post date:** [May 9, 2020, 4:10pm UTC](https://discuss.elastic.co/t/error-content-type-header-application-x-www-form-urlencoded-is-not-supported/231849/4 "2020-05-09T16:10:05Z")

</div>

So... I made some more research and I discovered that status 406 means that elastic can't use the input, but I am using json, does this means that my elasticsearch is having trouble understanding json?

If this is the case, what should I do?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 10, 2020, 1:57pm UTC](https://discuss.elastic.co/t/error-content-type-header-application-x-www-form-urlencoded-is-not-supported/231849/5 "2020-05-10T13:57:24Z")

</div>

The problem is that the content type is not correctly sent to elasticsearch. You need to read your curl tool help I believe.

---

<div class="post-metadata">

**Author:** ![joaopedro](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@joaopedro](https://discuss.elastic.co/u/joaopedro)\
**Post date:** [May 12, 2020, 9:10pm UTC](https://discuss.elastic.co/t/error-content-type-header-application-x-www-form-urlencoded-is-not-supported/231849/6 "2020-05-12T21:10:27Z")

</div>

> [@joaopedro](#):
>
> curl -XPOST "localhost:9200/students/student/1?pretty" -H'Content-Type: application/json' -d '{"joao":"pedro","bob":"michael"}'

I did it!

```
curl -H "Content-Type: application/json" --data @hello1.json http://localhost:9200/students/student/2?pretty

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 9, 2020, 9:10pm UTC](https://discuss.elastic.co/t/error-content-type-header-application-x-www-form-urlencoded-is-not-supported/231849/7 "2020-06-09T21:10:38Z")

</div>

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