I need to pass the following URL:
https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectFilter={"virtualGuests":{"hostname":{"operation":"hostnameTest"}}}
I tried by different ways, but it doesn't work, this is part of my code:
System.out.println(
given().
when().get("https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectFilter={\"virtualGuests\":{\"hostname\":{\"operation\":\"hostnameTest\"}}}").asString());
}
Exception:
java.lang.IllegalArgumentException: Invalid number of path parameters. Expected 1, was 0. Undefined path parameters are: "virtualGuests":{"hostname":{"operation":"hostnameTest".
According to the exception, I think I should need to use path parameters, I tried with that but I didn't have success.
Also, I tried to replace { with character escape code %7B.
Any ideas? Thanks in advance
Thanks a lot Sebastian and Robert!
I didn't have success using the encodeURI, however I used queryParam and it works
given().
queryParam("objectFilter", "{\"virtualGuests\":{\"hostname\":{\"operation\":\"hostnameTest\"}}}").
when().get("/SoftLayer_Account/getVirtualGuests")
.then().assertThat().body("id", hasItem(1111111));
Many Thanks!
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments