top of page
Search

How to add query Param in RestAssured Request

  • Writer: Dev Raj Sinha
    Dev Raj Sinha
  • Jun 17, 2023
  • 1 min read

To add query parameters to a RestAssured request, you can use the `queryParam()` method provided by RestAssured. This method allows you to specify one or more query parameters along with their values. Here's how you can add query parameters to a RestAssured request:


import io.restassured.RestAssured;
import io.restassured.response.Response;

Response response = RestAssured.given()
    .queryParam("param1", "value1")
    .queryParam("param2", "value2")
    .get("https://api.example.com/endpoint");

In this example, we're sending a GET request to `https://api.example.com/endpoint` with two query parameters: `param1` with a value of `"value1"` and `param2` with a value of `"value2"`. The `queryParam()` method is used to add each query parameter.

 
 
 

Recent Posts

See All

Comments


Never Miss a Post. Subscribe Now!

Find new exciting ways to dominate the IT Automation industry

Thanks for submitting!

bottom of page