How can I set characters like "{" in urls?

Ruber Cuellar Valenzuela

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

Ruber Cuellar Valenzuela

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to set IIS to return 404 for strange characters in urls like these ÃÂÃÂÃÂÃ?

From Dev

How can I type accented characters like ë?

From Dev

How can I redirect urls like this in my htaccess file?

From Dev

How can I type accentuated characters like ë? Need help

From Dev

How can I rewrite URLs?

From Dev

How can i set li tag with extra characters?

From Dev

How can I get a std::set of characters in a string, as strings?

From Dev

How can I remove words in a sentence starting with a particular set of characters?

From Dev

How can I set an environment variable which contains newline characters?

From Dev

Is there anything like "maxQueryTime"? and if yes then How can I set mongo maxQueryTime?

From Dev

How can I create a set-like array in bash?

From Dev

How can i set an arduino pin act like a jumper?

From Dev

how can i set view like alert and hide automatically in iOS

From Dev

Using composer and its json file, how can I set package specific URLS?

From Dev

How can I make a regular expression that contains special characters, like word boundaries, with a variable?

From Dev

How can I insert special characters like ☺☻♥♦♣ in password field which is declared as varchar in sql server

From Dev

How can I make a regular expression that contains special characters, like word boundaries, with a variable?

From Dev

How can I scan foreign characters (like ä, ß, ő, ű) and print them out to the console window as well?

From Dev

How can I use SQL's LIKE command with its own special characters?

From Dev

How can I set limits on how many characters can be inputted? (Java)

From Dev

Can i set a class like class = 8

From Dev

Can i set a class like class = 8

From Dev

How can I whitelist URLs in phonegap?

From Dev

How do I use curl with urls that contain brackets characters?

From Dev

How can I set a Java-like "static variable" in Perl that can be accessed by other classes ?

From Dev

How can I set my vim or terminal to be possible that if I write function it show document automatically like this image?

From Dev

How can I check if a string contains only a particular set of special characters in Javascript?

From Dev

How can I check if a string contains a given set of characters (disregarding order) using Regex?

From Dev

How can I set an Input Filter to accept only BINARY characters (0 or 1) on Android?

Related Related

  1. 1

    How to set IIS to return 404 for strange characters in urls like these ÃÂÃÂÃÂÃ?

  2. 2

    How can I type accented characters like ë?

  3. 3

    How can I redirect urls like this in my htaccess file?

  4. 4

    How can I type accentuated characters like ë? Need help

  5. 5

    How can I rewrite URLs?

  6. 6

    How can i set li tag with extra characters?

  7. 7

    How can I get a std::set of characters in a string, as strings?

  8. 8

    How can I remove words in a sentence starting with a particular set of characters?

  9. 9

    How can I set an environment variable which contains newline characters?

  10. 10

    Is there anything like "maxQueryTime"? and if yes then How can I set mongo maxQueryTime?

  11. 11

    How can I create a set-like array in bash?

  12. 12

    How can i set an arduino pin act like a jumper?

  13. 13

    how can i set view like alert and hide automatically in iOS

  14. 14

    Using composer and its json file, how can I set package specific URLS?

  15. 15

    How can I make a regular expression that contains special characters, like word boundaries, with a variable?

  16. 16

    How can I insert special characters like ☺☻♥♦♣ in password field which is declared as varchar in sql server

  17. 17

    How can I make a regular expression that contains special characters, like word boundaries, with a variable?

  18. 18

    How can I scan foreign characters (like ä, ß, ő, ű) and print them out to the console window as well?

  19. 19

    How can I use SQL's LIKE command with its own special characters?

  20. 20

    How can I set limits on how many characters can be inputted? (Java)

  21. 21

    Can i set a class like class = 8

  22. 22

    Can i set a class like class = 8

  23. 23

    How can I whitelist URLs in phonegap?

  24. 24

    How do I use curl with urls that contain brackets characters?

  25. 25

    How can I set a Java-like "static variable" in Perl that can be accessed by other classes ?

  26. 26

    How can I set my vim or terminal to be possible that if I write function it show document automatically like this image?

  27. 27

    How can I check if a string contains only a particular set of special characters in Javascript?

  28. 28

    How can I check if a string contains a given set of characters (disregarding order) using Regex?

  29. 29

    How can I set an Input Filter to accept only BINARY characters (0 or 1) on Android?

HotTag

Archive