Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass Query String Parameters in GET url using Rest Assured?

How to pass Query String Parameters in GET url using Rest Assured?

URL is: http://example.com/building

My Query Strings are :

globalDates:{"startMs":1473672973818,"endMs":1481448973817,"period":90}
limitTo:6
loadTvData:true
startFrom:0
userId:5834fb36981baacb6a876427
like image 293
kkashyap1707 Avatar asked Dec 11 '16 10:12

kkashyap1707


2 Answers

You can pass them as a queryParam ..

given()
.queryParam("globalDates", "{\"startMs\":1473672973818,\"endMs\":1481448973817,\"period\":90}")
.queryParam("startFrom", "0").queryParam("limitTo", "6").queryParam("loadTvData", true)
.queryParam("startFrom", "0").queryParam("userId", "5834fb36981baacb6a876427")
.when().get("http://example.com/building"). ...
like image 98
karunakar reddy Alchala Avatar answered Oct 08 '22 13:10

karunakar reddy Alchala


QueryParam can be passed as:

String endpoint = "http://example.com/building"; 

var response = given()
.queryParam("globalDates", "{\"startMs\":1473672973818,\"endMs\":1481448973817,\"period\":90}")
.queryParam("startFrom", "0").queryParam("limitTo", "6").queryParam("loadTvData", true)
.queryParam("startFrom", "0").queryParam("userId", "5834fb36981baacb6a876427")
.when().get(endpoint).then();
like image 41
Suman Avatar answered Oct 08 '22 14:10

Suman