0

I'm trying to write a code for GET Request in Java. But the URL contains special characters. How to handle those special characters so it is able to hit the API with the correct request target? The URL which I am using is similar to this: https://xyz.tech.environment/v1/payments?page[last]&filter[reference]=1234. Do I need to encode page[last]&filter[reference]? If so, how to?

General Grievance
  • 4,555
  • 31
  • 31
  • 45
  • You need to use `URLEncoder` on the arguments only, separately for each one. Not the URL itself. – user207421 Sep 17 '21 at 01:44
  • As suggested by @user207421, you can use URLEncoder. This solution may help: https://stackoverflow.com/a/10786112/5685911 – Akki Sep 21 '21 at 04:49

0 Answers0