title: Syntax to use parameters in Body section of HTTP Request Sampler in JMeter, using Rest API POST request with body and input from CSV file
body: <p>I'm using JMeter to test a microservice and I need to use a parameter dynamically with a different value in each request. Also, the parameter is a part of a query that contains other constant values as well.</p>
  
  <p>I defined user variables in the JMeter <em>user.properties</em> file (in JMeter <em>bin</em> folder):</p>
  
  <p><strong>JMeter -- bin/user.properties</strong></p>
  
  <pre><code># Parameters to use in JMeter
  ES_HOST=127.0.0.1
  ES_PORT=9200
  ES_INDEX=segments
  ES_TYPE=_doc
  THREAD=5
  CSVDATA_ROOT=C:/devtools/apache-jmeter-5.2.1/csv_data
  </code></pre>
  
  <p>Of course, I have <em>User-Defined Variables</em>:
  <a href="https://i.stack.imgur.com/WNCGz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WNCGz.png" alt="User Defined Variables"></a></p>
  
  <p>And how my <em>Test Plan</em> is defined in JMeter
  <a href="https://i.stack.imgur.com/QV1Dc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QV1Dc.png" alt="Thread Group Users"></a></p>
  
  <p><a href="https://i.stack.imgur.com/0QPFa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0QPFa.png" alt="CSV Data Set Config"></a></p>
  
  <p><a href="https://i.stack.imgur.com/bAUlj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bAUlj.png" alt="HTTP Request"></a></p>
  
  <p>As you can see in the following screenshot of <em>View Result Tree</em> the parameter <strong>agentName</strong> I defined and shown in the <em>HTTP Request</em> (above) is working.</p>
  
  <p>I want to define it in the body of the HTTP Request, to replace the hardcoded "John Doe" with a parameters that have a different value in each request. </p>
  
  <pre><code>"query":"SearchStartTime=2020-01-01 00:00:00.000TO2020-01-31 23:59:59.999&amp;AgentName=John Doe"}
  </code></pre>
  
  <p>How can I do that? 
  I need a way to add a parameter to an existing string</p>
  
  <p>I've already tried <a href="https://ecmarchitect.com/archives/2014/09/02/3915" rel="nofollow noreferrer">Using Apache JMeter to Test Elasticsearch (or any REST API)</a> and <a href="https://stackoverflow.com/questions/42549147/in-jmeter-what-would-be-syntax-of-parameters-in-body-data-section-of-http-reque">In Jmeter, What would be syntax of parameters in Body Data section of HTTP Request Sampler, for Rest APIs and input should be generated dynamically</a> also doesn't solve my problem.</p>
  
  <p><a href="https://i.stack.imgur.com/k4Dsz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k4Dsz.png" alt="View Result Tree"></a></p>