# Postman Code Snippets Kotlin

**URL:** <https://community.postman.com/t/postman-code-snippets-kotlin/7092>\
**Category:** Help Hub\
**Tags:** kotlin, postman\
**Created:** [August 10, 2019, 2:43pm UTC](https://community.postman.com/t/postman-code-snippets-kotlin/7092 "2019-08-10T14:43:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivansocket](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/ivansocket/32/2534_2.png) [@ivansocket](https://community.postman.com/u/ivansocket)\
**Post date:** [August 10, 2019, 2:43pm UTC](https://community.postman.com/t/postman-code-snippets-kotlin/7092/1 "2019-08-10T14:43:03Z")

</div>

Hello I am trying to transform a postman request that works to Kotlin language supported in Spring MVC where the same request doesn’t work, would be very gratefull if anyone could help me with this Issue.  
Postman:  
GET: [https://X.X.X.X:6200/something\_flow-2019-08-09/\_search?size=100](https://X.X.X.X:6200/something_flow-2019-08-09/_search?size=100)

with a Body-\> raw:  
{  
“query”: {  
“bool”: {  
“filter”: [  
{ “range”: { “timestamp”: { “gte”: “2019-08-09T06:00:00”,“lt”:“2019-08-09T07:00:00”}}}  
]  
}  
}  
}

The kotlin code I have done is this:  
val forEntity\_Flow = restTemplate.exchange(“[https://X.X.X.X:6200/something\_flow-$da/\_search/?size=50&pretty=1](https://X.X.X.X:6200/something_flow-%24da/_search/?size=50&pretty=1)”,  
HttpMethod.GET, HttpEntity("{\r\n\“query\”: { \r\n \“bool\”: { \r\n \“filter\”: [\r\n { \“range\”: { \“timestamp\”: { \“gte\”: \“2019-08-08T06:00:00\”,\“lt\”:\“2019-08-08T10:00:00\”}}} \r\n]\r\n }\r\n }\r\n}", headers), ResultsFlow::class.java)

The code executes but the body that is used to filter timestamp values is “ignored”.  
What should I do to make this work?  
Thank you !

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [August 12, 2019, 2:24pm UTC](https://community.postman.com/t/postman-code-snippets-kotlin/7092/2 "2019-08-12T14:24:21Z")

</div>

It seems that you are using HttpMethod.GET when you actually want to do a POST.

---

<div class="post-metadata">

**Author:** ![ivansocket](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/ivansocket/32/2534_2.png) [@ivansocket](https://community.postman.com/u/ivansocket)\
**Post date:** [August 12, 2019, 2:41pm UTC](https://community.postman.com/t/postman-code-snippets-kotlin/7092/4 "2019-08-12T14:41:19Z")

</div>

The Body from the GET request is used to filter the data. I don’t want to change the server data, I want to receive it filtered with the body rule (timestamp greater or equal to x and lower than y)
