# Logstash filter http body with boolean values error

**URL:** <https://discuss.elastic.co/t/logstash-filter-http-body-with-boolean-values-error/355852>\
**Category:** Logstash\
**Created:** [March 20, 2024, 10:01pm UTC](https://discuss.elastic.co/t/logstash-filter-http-body-with-boolean-values-error/355852 "2024-03-20T22:01:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [March 20, 2024, 10:01pm UTC](https://discuss.elastic.co/t/logstash-filter-http-body-with-boolean-values-error/355852/1 "2024-03-20T22:01:43Z")

</div>

Having issues dealing with a value that needs to be a boolean in the body.  
Errors  
body\_format json errors  
{"type":"/request/invalid","title":"Bad Request","status":400,"detail":"Format of field article is invalid"}"}  
body\_format text errors  
{"type":"/request/invalid","title":"HTTP 415 Unsupported Media Type","status":415,"detail":"HTTP 415 Unsupported Media Type"}"}

```auto
 http {
      body_format => "text"
      follow_redirects => false
      body => '{"url": "%{[article_url]}", "article": true}'
      url => "...."
      verb => "POST"
    }

    http {
      body_format => "json"
      follow_redirects => false
      body => {
        "url" => "%{[article_url]}"
        "article" => true
      }
      url => "...."
      verb => "POST"
    }

```

---

<div class="post-metadata">

**Author:** ![Dallas\_Toth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dallas_toth/32/22630_2.png) [@Dallas\_Toth](https://discuss.elastic.co/u/Dallas_Toth)\
**Post date:** [March 23, 2024, 5:43pm UTC](https://discuss.elastic.co/t/logstash-filter-http-body-with-boolean-values-error/355852/2 "2024-03-23T17:43:09Z")

</div>

I found a resolution.  
This should really be part of your documentation.

```auto
Works but you must have the headers "Content-Type"
http {
      body_format => "text"
      follow_redirects => false
      body => '{"url": "%{[article_url]}", "article": true}'
      url => "...."
      verb => "POST"
        headers => [ 
            "Content-Type", "application/json"
        ]
    }

Does not work the issue is "article" => true that causes an error
    http {
      body_format => "json"
      follow_redirects => false
      body => {
        "url" => "%{[article_url]}"
        "article" => true
      }
      url => "...."
      verb => "POST"
    }

```

---

<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:** [April 20, 2024, 5:43pm UTC](https://discuss.elastic.co/t/logstash-filter-http-body-with-boolean-values-error/355852/3 "2024-04-20T17:43:22Z")

</div>

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