Passing a URL parameter WITHOUT ENCODING

Hello Toolers,

I am trying to pass a URL parameter into a Retool REST API query, but the parameters contains a percentage sign (%). Due to this Retool encodes the value and replaces all percent signs into their encoded value (%25), which messes up the parameter.

(notice how retool converts pg51ovhfczf8%3A1630065917.0 to pg51ovhfczf8%253A1630065917.0)

I have tried splitting up the value like this.
But unfortunately it still gets encoded. The only way that works is to directly type in the value and not use a variable like this
However I need to be able to use a variable for this task.

Is there any way to disable the URL encoding for a URL parameter?



Hi, does your API not accept URL escaped characters? Typically when a URL get sent with special characters (including %), it gets encoded with percent encoding, all APIs should be able to handle this. If this is still a problem you can try setting the cursor to be {{ encodeURI(cursorvalue.value) }}

1 Like

Hi Bill, unfortunately this specific parameter (which is essentially a next page token) needs to be exactly the same and cannot be encoded at all. Otherwise the API is unable to find the next page. I agree that it is definitely a strange design choice to include a % in a next page token, and to not account for URL encoding, but sadly I don't own the API I am working with.

I went ahead and tried your suggestion, but that does the opposite -- I am trying to disable the encoding which automatically gets applied by retool when passing a variable as a URL parameter. So if a function like {{skipUriEncoding(cursorvalue.value)}} exists, or some other work-around that you can think of, or if this is simply not possible, please let me know.

Thank you for your help!

Nevermind, I just realized that the cursor I was receiving had already been encoded, and passing it as a parameter led to it being encoded twice basically. I think I can work around this by decoding it first, then passing it as URL parameter.

1 Like

Ah I see! Let me know if everything works out!

I'm in the same boat. How do I decode it first? What is the library function in ReTool?

This is a default JS function rather than a Retool specific one, but depending on how the string was originally encoded it would most likely be either decodeURI(value) or decodeURIComponent(value)

1 Like