How to add Query Param in Get call in RestAssured for API Testing

How to add Query Param in Get call in RestAssured for API Testing.

below is the URL.

http://hellomap/v1/TCDerofiles?$expand=details&$filter=10002

 

hereĀ $expand=details&$filter=10002

these 2 are query params. how to pass in restassured.

 

It would be great. if someone help me on this.

Default Asked on September 18, 2018 in Software Testing.
Add Comment
  • 1 Answer(s)

    In you request specification, add a queryParameter

    RequestSpecification requestSpecification = RestAssured.given().queryParam(“paramName”,”paramValue”)

     

    If there are more than one paramter, use :

    Map<String,?> params=new HashMap<>;

    params.put(“param1″,”value1”);

    params.put(“param2”,value2);

    RequestSpecification requestSpecification = RestAssured.given().queryParams(params);

    Default Answered on September 21, 2018.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.