Performance Testing of a RESTful API using JMeter

Apache JMeter is open-source software that is popular for performance testing. This tool is designed to load test functional behavior and measure performance.

This article is about how to use JMeter for Performance Testing of a RESTful API. In this, we will learn how to configure JMeter and test a REST API to know how efficiently it works and how many concurrent users the server can handle.


To access more of this article, please provide the following information.

Sukhwinder Singh

Sukhwinder Singh

Senior Quality Assurance Engineer

Sukhwinder Singh is a Senior Quality Assurance Engineer at 3Pillar Global with over 3 years of experience in the field. His skills include manual testing, test automation, and performance testing. Prior to joining 3Pillar, he worked at CapeGemini and Hyperabad, and worked on projects related to the financial sector for a variety of clients. He loves exploring new tools and techniques related to performance testing and cloud computing.

26 Responses to “Performance Testing of a RESTful API using JMeter”
  1. amar on

    I have captured the json response as a string using:

    var data = prev.getResponseDataAsString();

    Now, I want to add some more items (hardcoded) to this response and send it back as a request. How could i do so.?


    Please let me know

    • Vishal on

      Hi Amar,

      Once you have received the response, you can extract the desired field from the response and then you can use this extracted value along with the hardcoded values in your next request.
      Lets assume you have Email id in your response and you have extracted it in variable ’email’.
      Now in your next request you can use this variable alongwith other hardcoded values as below:

      NewEmail = ${email}+”AppendedValue”;

      Hope i answered your query.

  2. Karan on

    Hi Sukhwinder,

    Please share the address of the web service for the above test.


  3. Apoorv Sharma on

    Nice article.

  4. Paraminder Singh on

    For customer requirements, I will be following the steps mentioned in /performance-testing-of-a-restful-api-using-jmeter and I wil get back to you for more insights

  5. Ashish on

    Helllo Sir,

    While I am trying to run my jmeter script, I can not able to redirect on home page after login.

    Facing below Error on response.

    if(“undefined”==typeof jQuery)throw new Error(“Bootstrap’s JavaScript requires jQuery”);+function(n){var t=n.fn.jquery.split(” “)[0].split(“.”);if(t[0]<2&&t[1]<9||1==t[0]&&9==t[1]&&t[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or

    Please suggest.

  6. Aswathy on

    I am using JSR223 post processor to extract value from json and the value is stored in a jmeter variable,but I can’t access the jmeter value in http request path by using-${variable}.The value is not at all accesible from GUI mode,but in non gui(On running the script as maven)it is working sometimes

  7. Divyashri Somayaji on

    Hello Sir, I am testing a website using jmeter. I recorded it using https script recorder.Many http request displayed and all parameters are displayed in the body data part instead of parameter part of http request. Why is that so? How to retrive them?why they are displayed in body data part? Please reply

  8. Aakash Singh on

    Any method to assert the data, when response is in XML?

  9. Yashwanth Nali on

    Hi there

    I’ve been trying to send an HTTP request (JSON file) using Jmeter. But I am facing HTTP 400 error.
    Tried using cache manager, cookie manager and provided a constant timer so that the requests can go periodically.
    Still, I am facing that 400 error issue. There no problem with the URL or the JSON file.
    Kindly help me in resolving the 400 Error.

  10. Arasakuamri on

    I have created a test case for login & booking like ola/uber app. I need to pass a user authentication key for next call. For single thread it works. But if i increase thread count, authentication failed response showing. So i need to pass recently executed login authentication key for next call. How do i? Please help me out to execute the load test. I need a beanshell post procesor query to pass recently generated auth key.
    Note: Auth key will be generated in first call. Need to save and pass in next call header
    My beanshell script is.,
    import org.json.JSONObject;
    import org.json.JSONArray;
    String Response1 = prev.getResponseDataAsString();
    JSONObject StrResp1 = new JSONObject(Response1);
    JSONObject loginUser = StrResp1.getJSONArray(“detail”).getJSONObject(0).getJSONObject(“auth_details”);
    String authToken = loginUser.getString(“auth_key”);
    String userId = loginUser.getString(“user_id”);
    String userType = loginUser.getString(“user_type”);


  11. arun on

    Hi Sukhwinder,

    I have to run an rest api service called “Create Order” i can execute this POST service by giving body with only one user…To execute this service i need to run other 3 service ..How to run all this service together.

  12. arun on

    i need to run an rest api service called create order …to execute that service i need to run other 3 services …how to run this service all together in jmeter

    • Akash on

      I receive an encrypted response, now I want to decrypt it and use that response to be sent to next request. How will this be possible?

  13. Ajitesh shukla on

    Great explanation, Sukhwinder

  14. Shiva on

    can you please help to know how to generate performance graphs using jmeter

    • Chetan Jain on


      Please run the following command, it should generate the performance graph.
      Command :
      jmeter -g -o

      Pre-Requisite: Generate the CSV file in jmeter

  15. Vish on

    I am getting “Too many open files” and “Socket closed” exceptions. How to fix it?

  16. Anshul Agrawal on

    How will you get the report while running jmeter as non gui mode?

    No of API (test cases ) =350

  17. karan on


    I have to perform the load testing of 10 APIs and their is dependencies of First API to Second API(Token Passing) and so on. The script is running fine for one user when I increased the load of user. The script getting failed in response menu I am getting error “input required” but all the token as has been extracted to the second api from first. Can you help me out in this.


  18. BHUMIL on

    Hi Sir,

    I have to load 50k users in mongo DB, while running the API using CSV with dynamic data i am getting “end point timeout” and script goes fail.

    I am getting this error in login API in which i am getting token using json extractor.

    Adding ramp up time resolve this issue ? or please suggest me the best way to deal with it.

  19. Akash on

    I receive an encrypted response, now I want to decrypt it and use that response to be sent to next request. How will this be possible?

  20. Pavan Patke on

    I’m trying to run POST method api web service. I need to parameterise 2 fields from the request body. I’m not able to paramaterise the fields from request body using csv set config. When I enter values in the csv files, first parameter value is replaced with first row values. 2nd parameter field is not at all replaced with any value. Please can you parameterise values from “body data” instead from “parameters”?

    Thank you

  21. nivedita singh on

    How to handle POST request with both parameters and body.

    Thanks in advance.

  22. Roopa on

    Does JMeter 5.0 support PATCH rest call ?
    I see it in the dropdown in HTTP Request , but getting error as below. Invalid HTTP method: PATCH
    at Source)
    at Source)
    at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.setupConnection(
    at org.apache.jmeter.protocol.http.sampler.HTTPJavaImpl.sample(
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(
    at org.apache.jmeter.threads.JMeterThread.doSampling(
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(
    at org.apache.jmeter.threads.JMeterThread.processSampler(
    at Source)

  23. Himanshu on

    Hi Sukhwinder,
    Thanks for sharing this post.
    I have requirement where I want to run the multiple requests sequentially like one after another.
    Could you please provide your inputs to achieve that.

Leave a Reply