Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Passing Encoded Special Characters to Download Tool

Jon-Knepper
8 - Asteroid

Hello Community!

 

I am having some trouble with using the Tableau Rest API and the download tool.  I can currently get images of dashboards from it, but it becomes an issue when I have a filter that contains a special character "&".  I have found out that if I have a %5C in front of the encoded version, so "%5C%26, then it will work. 

 

Before I found this out I was having the download tool encode my strings so that they can be passed to the API.  The issue is that this type of encoding doesn't work for me since I have to add the %5C to certain special characters.  Along with this I was having the download tool add the authorization header.  When I try to encode before and send it it I keep getting errors.  I believe my problem is that I don't understand what the download tool is doing (how it modifies structure of the string that is passed through to the API) when it adds the header to the string.  I believe I need to have the header encoded as well so that the entire string is encoded and passed to the download tool.  That way I can dynamically change my encoding of my special characters, when needed, and pass them to the tool.

 

Let me know if I am not making sense. :)

7 REPLIES 7
Felipe_Ribeir0
16 - Nebula

Hi @Jon-Knepper 

 

When you make any API call, the special characters are encoded (here you can put any special character and see the translation of it) HTML URL Encoding Reference (w3schools.com)

 

Example: & becomes %26 like you already found.

Felipe_Ribeir0_1-1667228062032.png

 

But the download tool already do this encoding job for us with this Encoded URL Text option enabled, so i dont understand why it is not working for you:

 

Felipe_Ribeir0_2-1667228170301.png

 

 

Here i have a workflow that was doing exactly the same thing (get pdf prints of filtered tableau dashboards, 1 pdf per client), and i was passing the filter (with the &) inside the url maybe the attached workflow can help you to understand if there is some missing step on your workflow:

 

Felipe_Ribeir0_0-1667227998314.png

 

Jon-Knepper
8 - Asteroid

@Felipe_Ribeir0 

 

Thank you for providing an answer.  I actually did some more testing and found something out.  Right now I am feeding my workflow an excel file that connects various data points together (View ID and API Filters).  When I pass VIew ID and the filter through "vf_Product="Chairs & Tables", adding it after the ? in my URL that is nearly an identical string from your screenshot, I get an image that has my dashboard titles but no data.  When I try "vf_Product="Chairs \& Tables" I still get the same, but when I don't add it to the URL and add it as a field as a part of the payload in the download tool, formula tool with  "vf_Product" being the field name and "Chairs \& Tables" as the value,  my table gets populated with data from the "Chairs & Tables" product.  

 

Do you happen to know what the Payload tab in the download tool is doing that is different from just encoding ""vf_Product="Chairs \& Tables" along with the rest of the URL in the download tool?

Felipe_Ribeir0
16 - Nebula

Now i understood, the \s(space) and & are inside your filter parameter. Here the situation was more simpler inside my filter, just the client name.

 

1)It is possible for you to test the filter with a "normal" product, like "Chair"? If it works, you would be sure that the problem is the special characters. It looks like this is the case, because your download is coming with null data.

 

2)When you filter this product manually inside tableau server how does the url looks like? Chairs%20%26%20Tables?

 

 

Felipe_Ribeir0_2-1667231478786.png

 

I found some other users with the same issue: Escaping special characters in URL filters (tableau.com)

 

And i found the official resolution proposed by Tableau: Unable to Use Special Characters in URL Parameters | Tableau Software

Jon-Knepper
8 - Asteroid

@Felipe_Ribeir0 

 

When I filter on on just "Chair" the data comes through as expected.  So I know the special character is throwing it off.  As for filtering it on the server, I don't the URL actually doesn't update at all when changing the filter.  It remains the same no mater what I filter it to. 

 

I am just surprised that I am unable to feed the download tool the whole URL with filters that includes the "\" in front of the "&" and have it work.  The Payload option works with the exact same Field name and Value.  I am not sure why it works though and what is doing differently.  Not sure if there is any way to get an output of how it actually encodes the URL with and without the payload?

 

Its just not a great solution as my field names are not always the same and the excel file makes it dynamic so I can use one download tool for many different views. 

Felipe_Ribeir0
16 - Nebula

Unfortunately this seems really like a tableau issue, you gonna have to build some workaround based on their proposed "resolution".

 

I am not currently working on a client with Tableau, so unfortunately i cannot go much further doing some tests.

 

What i would try to do:

 

1)Disable the encoding

Felipe_Ribeir0_1-1667233203628.png

 

2)Use the replace tool to build the encoding to match their requirements considering this

-HTML URL Encoding Reference (w3schools.com)
-https://kb.tableau.com/articles/issue/special-characters-in-url-parameters?_ga=2.193249134.235088168...

 

As i said, i cannot test it, but i think that it would be something like this:

Felipe_Ribeir0_0-1667233189072.png

 

Jon-Knepper
8 - Asteroid

@Felipe_Ribeir0 

 

I actually gave this a shot and the URL encode via the formula tool doesn't seem to be working.  It encodes a backslash into a forward slash.  Even when I change it to %5C and encode the rest of the string and do not select the encode option on the download tool it doesn't work.  The only thing that has worked is sending the information to the download tool, create a separate field for my filter, add it as a part of the payload tab and then allowing the download tool to encode the string.

 

When selecting the encode option on the download tool is it also encoding the headers?  That may be the problem when I am sending the information to the download tool pre-encoded.

Felipe_Ribeir0
16 - Nebula

Hi @Jon-Knepper 

 

Just to share with you, i found a software that is able to see what the download tool is generating (the software came from this topic Using CSRF Token in Download Tool - Alteryx Community). I had a similar necessity today and it works fine!

 

Download Fiddler Web Debugging Tool for Free by Telerik

 

Felipe_Ribeir0_0-1668119545704.png

 

Labels