# Get a value from a CSV feeder to create a POST request body

**URL:** <https://community.gatling.io/t/get-a-value-from-a-csv-feeder-to-create-a-post-request-body/4548>\
**Category:** Gatling (Open-Source)\
**Created:** [October 5, 2018, 8:26am UTC](https://community.gatling.io/t/get-a-value-from-a-csv-feeder-to-create-a-post-request-body/4548 "2018-10-05T08:26:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vitalii\_Plagov](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@Vitalii\_Plagov](https://community.gatling.io/u/Vitalii_Plagov)\
**Post date:** [October 5, 2018, 8:26am UTC](https://community.gatling.io/t/get-a-value-from-a-csv-feeder-to-create-a-post-request-body/4548/1 "2018-10-05T08:26:46Z")

</div>

Hello.

I have a pretty simple scenario to get a random value from a CSV file that contains only one column with header id. Then, I want to paste this value into a body of a POST request. The body of my request looks as follows:  
{ “id” : “123” }. So, instead of “123”, I need to use a value from CSV file. Here are my feeder and scenario:

```auto

val csvFeeder = csv("src/test/resources/ID.csv").random

val scn = scenario("Test POST request")
  .feed(csvFeeder)
  .exec(http("Test POST request")
    .post(uri)
    .header("Content-type", "application/json")
    .body(StringBody("{\"id\":\"$id\"}"))
    .check(status is 200, responseTimeInMillis lte 2000)
  )

```

This example is the closest implementation I managed to make so far. But it doesn’t work as I expect. I can’t paste the value from a feeder into $id that is inside a body(). Currently, Gatling sends the following body: {“id”:"$id"}

Could you please help me and advise how can I paste a feeder value into a POST request body?  
This test is my first experience with Gatling and Scala, thus I might not understand and miss some basic things…

---

<div class="post-metadata">

**Author:** ![Vitalii\_Plagov](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@Vitalii\_Plagov](https://community.gatling.io/u/Vitalii_Plagov)\
**Post date:** [October 5, 2018, 12:44pm UTC](https://community.gatling.io/t/get-a-value-from-a-csv-feeder-to-create-a-post-request-body/4548/2 "2018-10-05T12:44:07Z")

</div>

Found the solution. The code is right. The issue was in the version of artifact I was using. I used version 3.0.0-RC3 and gatling-maven-plugin was 3.0.0. Not I switched to 2.3.1 for gatling-core and 2.2.4 for maven plugin. Now it works.

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [October 5, 2018, 12:47pm UTC](https://community.gatling.io/t/get-a-value-from-a-csv-feeder-to-create-a-post-request-body/4548/3 "2018-10-05T12:47:45Z")

</div>

No, your code is wrong.

{“id”:"\*\*$\*\ ***id**"}

The proper Gatling EL syntax is ${id}.

---

<div class="post-metadata">

**Author:** ![Vitalii\_Plagov](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@Vitalii\_Plagov](https://community.gatling.io/u/Vitalii_Plagov)\
**Post date:** [October 5, 2018, 1:51pm UTC](https://community.gatling.io/t/get-a-value-from-a-csv-feeder-to-create-a-post-request-body/4548/4 "2018-10-05T13:51:08Z")

</div>

Yes, that is as well. But before changing the version of dependencies, I tried both $id and ${id} and had no luck.
