The web application is built in AngularJS and has AJAX calls. It is built on Service now platform. Recently the platform is upgraded and there are complete UI changes.

Before the upgrade, we were able to see the list of ticket ids in a web page in HTML mode. The flow was to pick one ticket randomly and perform action on the same.

After the upgrade, we are able to see only header part of the page where as ticket id table is not displaying. After analysis, it has been understood that the get call for the page needs to be sent along with one API now post call which contains JSON payload to view the table.

I tried to use groovy sampler as described in blazemeter knowledge base . I am able to define the URLs but not the post request payload also tried example sampler with no luck.

Please suggest the work around to solve the issue.

enter image description here

  • @Dmitri T Can you please help
    – Raj
    Sep 16, 2017 at 2:47

1 Answer 1


If your question is about how to send a HTTP POST request with JSON body from JSR223 Sampler, kindly find example code below:

import org.apache.http.client.methods.HttpPost
import org.apache.http.entity.ContentType
import org.apache.http.entity.StringEntity
import org.apache.http.impl.client.HttpClientBuilder
import org.apache.http.util.EntityUtils

def client = HttpClientBuilder.create().build()

def entity = new StringEntity(

def post = new HttpPost('http://put_your_url_here')

def response = client.execute(post)

SampleResult.setResponseCode(response.getStatusLine().getStatusCode() as String)

Check out Apache Groovy - Why and How You Should Use It article for more information on using Groovy scripting in JMeter tests.

  • 1
    Thank u @Dmitri T for the response. My requirement is to send one get request + one Post request containing JSON body simultaneously. I tried defining both urls using JSR233 Sampler. parameters but not sure how to call both get and Post in groovy script. Please find the sample requirement screenshot
    – Raj
    Sep 18, 2017 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.