Welcome to another blog post about Power Automate Functions: EncodeURIComponent DecodeURIComponent. EncodeURIComponent is used to protect the URLs by encoding them. And DecodeURIComponent is used to decode the URL by decoding it. Today we're going to see that how can we use both of these functions in power automate. We will write expressions for both of these functions and I will show you step by step that how can we Encode URL and Decode URL using EncodeURIComponent and DecodeURIComponent respectively.
Some characters are used to safe url like mentioned below:
: = %3A
/ = %2F
Space = %20
So, we will use EncodeURIComponent to encode our URL or to protect our URL.
Input:
https://www.shahryarsultan.com/
The output will be as:
https%3A%2F%2Fwww.shahryarsultan.com%2F
EncodedUriComponent will be used for this purpose.
We have to initial variables like:
Initialize a variable here and set its attributes
Set its attributes like give a Name to it set its type from the dropdown button and then set the value you want to encode or decode
Search compose action from the search bar:
First, we initialize the variable and then make an action for output then call the variable in expressions
Expression: encodeUriComponent(variables('Decode or Encode URL'))
Here is the output:
To Decode URL, I am taking the output from the compose and then I will use DecodeURIComponent. In this way we can decode the URL as well.
Use the ‘decodeUriComponent’
Expression: DecodeUriComponent(outputs('Compose'))
Output of DecodeURIComponent
0 Comments
Thanks for commenting. Your comment will be live soon after approval.