Encode Component
This function encodes all special characters of a string into an encoded text string for use in a URL.
This function is the inverse of the Decode Component function.
If you want to build out a URL where a value is returned from a previous step, then you can use this function to encode that value.
For situations where you have multiple entries to encode, use the Encode Query function card. That function uses an object to build a single encoded query string.
Input
Field | Definition | Type | Required |
---|---|---|---|
text |
The text string to encode. |
Text |
TRUE |
Output
Field | Definition | Type |
---|---|---|
output |
The encoded text. |
Text |
Delimiters and special characters
When making API requests, it's essential to encode any special characters to ensure that the server interprets them correctly. However, don't encode any delimiters used in the URL.
Special characters include spaces, punctuation marks, and non-ASCII characters. These characters can cause issues in URLs if you don't properly encode them.
Delimiters are essential parts of the URL structure, so don't encode them. The ? delimiter for query strings is a literal character inside the URL. This delimiter is used so the web server knows where the path ends and where the query string begins.
See Special characters and delimiters.
Example
If your input is Sherlock Holmes: Detective, then the encoded output is Sherlock%20Holmes%3A%20Detective.
You can then use the Format function card to build the full URL. Adding the encoded output to https://www.example.com/searchcustomers?name= results in the full URL: https://www.example.com/searchcustomers?name=Sherlock%20Holmes%3A%20Detective.