Skip to main content
Nintex Community Menu Bar

The other day I overheard someone needing to encode/decode a URL string inside of a Nintex Workflow (and again at the Nintex 2017 InspireX during a presentation on Azure Functions). Presently this is a non-trivial task (more information here), so I decided to simplify the process a bit by creating a set of REST web service endpoints that would handle the encoding/decoding process.

These web services can easily be called from the Nintex Workflow Web Request actions in On premises products as well as O365.

To use these web service endpoints, configure a 'Web Request' action to POST application/json content to these endpoints:

Encode: http://swunaapi.azurewebsites.net/api/Url/Encode 

Decode: http://swunaapi.azurewebsites.net/api/Url/Decode 

To use the endpoints POST the following JSON:

{"value" : "Url To Encode/Decode"}

Very cool!


For those of us who know this is impressive but don't really know what it means, can you give an example of when one might want to use this? Or for what reason?


Hi Rhia,

Thanks for the feedback! I suppose I should have called a bit more attention to my mention of the UserVoice entry that prompted me to build this initially: https://nintex.uservoice.com/forums/229405-1-nintex-workflow-for-sharepoint/suggestions/10284486-add-url-encode-and-url-decode-action

Here is the contents so folks do not have to click over:

Add "URL encode" and "URL decode" Action

We meet situations quite often when need to create customized URL which is saved and used later for redirecting within or outside SP. For this purpose we need to encode input text to valid URL and save it.

Opposite situation is for reading existing URL (decode) and parsing several elements for additional usage.

While URL encode / decode is quite simple for programmer (few lines of code) but very difficult (or impossible) to perform with current tools such as "Build String" for WF designer.

Existing/known workaround:
http://www.vadimtabakman.com/nintex-workflow-url-encoding-user-defined-action.aspx
Multiple embedded "fn-Replace" functions are not a good solution because there can be many of them and WF designer can forget some and the result is not good. Maintenance of such a UDA is also very difficult.

Suggested solution:
http://meyerweb.com/eric/tools/dencoder/
Both functions are quite easy to perform in Visual Studio. Included link shows how it should work.

Thank you!
Michal


I have had a use case where I needed to take user input to create a new list/library in SharePoint, so had to "encode" their input to deal with all characters that can't be used in URLs.  Instead of properly encoding the URL, I used a regular expression action in a workflow to just remove all the illegal characters.  It can be a bit ugly, but it's another workaround for some situations.

Regular expression pattern:

'|.|/|-|s|!|*|(|)|;|:|@|&|,|?|%|#|#|]

(The | means “or” in regex, and is the escape character.)

Interpretation:

“If you find any of these weird characters in the Title, replace them with nothing, then save the result in the variable CleanNameForURL”.


I think you were one of the folks that inspired the creation of this haha!


Just wondering, when this will be integrated inside Nintex for Office 365?

Is there any assurance that the API above will stay forever?


Hey aaron_labiosa,



Thanks for your explanation in the comments section, for better explaining, why to use the Encoding/Decoding function. Here is a tool I would like to recommend, you must check it out. 



https://url-decode.com/



that tool provides a wide variety of other online web development utilities


Reply