0

I am calling a Get method through Rest and my URI contains { } for object filters in Softlayer. I have used %7B for { and %7D for }, but I get java.net.URISyntaxException.

The URI also contains @ which I have replaced with %40. This is working. I am using http Client to execute my Rest Call. The URI works fine on Postman, both with and without URL Encoding.

halfer
  • 19,824
  • 17
  • 99
  • 186
Ansu
  • 41
  • 8

1 Answers1

0

Here two way to skip or handle @:

Another way to skip special characters would be, using "\" at the start from any of these chars, here an example of this:

Also, it's necessary to skip {}": (special chars in objectFilters), if you are continue hitting with the exception, would be great if you could provide an example or the exactly code that you are trying, for further assistance


How to get Virtual Guests for a specific datacenter

Here a rest request for dal05 datacenter:

https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectMask=mask%5Bid%2Chostname%5D&objectFilter=%7B%22virtualGuests%22%3A%7B%22datacenter%22%3A%7B%22name%22%3A%7B%22operation%22%3A%22dal05%22%7D%7D%7D%7D
Community
  • 1
  • 1
  • This is the URL that I am trying to access. I have skipped " with a \ , but we cannot do the same for { }. `https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectMask=mask[id,hostname]&objectFilter={“virtualGuests” :{“datacenter":{"name":{"operation":"dal05”}}}}` – Ansu Mar 21 '17 at 17:46
  • Could you try the request that I posted in my answer please? Let me know if you have success with that – Ruber Cuellar Valenzuela Mar 21 '17 at 18:41
  • %7B is for { and %7D is for }, I had thought i could give a \ for ", but it has to be encoded with %22 and : with %3A. Thank you for the help. – Ansu Mar 22 '17 at 06:36