# Http\_endpoint only accepts JSON, even with a different content\_type

**URL:** https://discuss.elastic.co/t/http-endpoint-only-accepts-json-even-with-a-different-content-type/276329
**Category:** Beats
**Tags:** filebeat
**Created:** [June 18, 2021, 1:05am UTC](https://discuss.elastic.co/t/http-endpoint-only-accepts-json-even-with-a-different-content-type/276329 "2021-06-18T01:05:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jhbigler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jhbigler/32/99133_2.png) [@jhbigler](https://discuss.elastic.co/u/jhbigler)
#### Post date: [June 18, 2021, 1:05am UTC](https://discuss.elastic.co/t/http-endpoint-only-accepts-json-even-with-a-different-content-type/276329/1 "2021-06-18T01:05:33Z")

</div>

We would like to use filebeat to accept data from Apache Nifi in the form of a POST request, run it through some processors and send it to Elasticsearch. The [documentation on the http\_endpoint](https://www.elastic.co/guide/en/beats/filebeat/7.13/filebeat-input-http_endpoint.html#_content_type) seems to suggest that the http\_endpoint usually expects data to be JSON-formatted - however this can be overruled by setting the content\_type setting to something else:

_By default the input expects the incoming POST to include a Content-Type of application/json to try to enforce the incoming data to be valid JSON. In certain scenarios when the source of the request is not able to do that, it can be overwritten with another value or set to null._

This is required for us because we receive large volumes of CSV data. However, it seems like the http\_endpoint expects data to always be JSON-formatted, no matter what the content\_type is configured to be.

Example filebeat.yml:

```auto
filebeat.inputs:
- type: http_endpoint
  enabled: true
  listen_address: 0.0.0.0
  listen_port: 8889
  content_type: ""

output.console:

```

Example curl command once you start filebeat:

```auto
$ curl -d 'this,is,a,test' localhost:8889/ -XPOST
{"message": "Only JSON objects are accepted"}

```

Am I simply misunderstanding the documentation and this is intended functionality, or could this be a bug?

Version details:  
$ ./filebeat version  
filebeat version 7.13.2 (amd64), libbeat 7.13.2 [686ba416a74193f2e69dcfa2eb142f4364a79307 built 2021-06-10 21:04:13 +0000 UTC]

---

<div class="post-metadata">

### Author: ![ChrsMark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrsmark/32/55858_2.png) [@ChrsMark](https://discuss.elastic.co/u/ChrsMark)
#### Post date: [June 18, 2021, 10:46am UTC](https://discuss.elastic.co/t/http-endpoint-only-accepts-json-even-with-a-different-content-type/276329/2 "2021-06-18T10:46:59Z")

</div>

Hi!

`content_type` is meant only for content checks, you can leave it blank if the sender does not add the appropriate header but the content still needs to be a valid json.

---

<div class="post-metadata">

### Author: ![jhbigler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jhbigler/32/99133_2.png) [@jhbigler](https://discuss.elastic.co/u/jhbigler)
#### Post date: [June 18, 2021, 3:14pm UTC](https://discuss.elastic.co/t/http-endpoint-only-accepts-json-even-with-a-different-content-type/276329/3 "2021-06-18T15:14:02Z")

</div>

Thanks for the clarification. IMO it would be helpful if the documentation on this input explicitly explained that only JSON is accepted - as it is written, it can confuse noobs such as myself 🙂

---

<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: [July 16, 2021, 5:14pm UTC](https://discuss.elastic.co/t/http-endpoint-only-accepts-json-even-with-a-different-content-type/276329/4 "2021-07-16T17:14:06Z")

</div>

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