Get Request Error: "Caused by: java.net.URISyntaxException: Illegal character in query at index "

I am getting an error while executing a workflow to validate the address with USPS api.
I am using a string manipulation to construct the string like this
image
I am able to test the API with the string generated from the string manipulation node but when I am passing it to “Get Request” node I am getting “Illegal character” error.
Any help will be appreciated.
image

Hi,
the string you have given is not a valid URI, as brackets like this: <> are not allowed. You can encode them manually using %3C and %3E for the brackets and %20 for the spaces, which are also not allowed. Or you break up your query and encode the values of the GET parameters using a Java Snippet node like in the attached workflow. This is definitely the cleaner solution.
Kind regards
Alexander

url_encode.knwf (7.8 KB)

4 Likes

Hello Alexander,
Really appreciate your response.
Works like a charm and resolved my issue
I found encoding it just before the get request worked better.
Thanks for your support

3 Likes

There are also URL Encode / Decode nodes in the Vernalis community contribution which should sort this out for you:

and

Again, you would need to pass in the query values separately to encode them

Steve

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.