URL Parameter Module
Module Functionality
The URL Parameter Module (also known as the Global Module) is used to extract specific parameter values from a given URL. Users can define the parameter name they want to extract through simple configurations, and the module will parse the URL and output the corresponding parameter value. This module is widely used in scenarios where dynamic URL parameters need to be retrieved and used for subsequent logic processing.
Module Features
-
Single Parameter Extraction:
- Each module instance can only extract the value of one specified parameter.
- To extract multiple values, use separate URL Parameter Module instances for each parameter.
-
Fixed Output Format:
- The Output format only supports
String
.
- The Output format only supports
-
Scope of Application:
- Applicable to standard URL parameter formats, such as
https://example.com?key=value&other=123
. - Supports extracting parameter values only from the query string part of the URL (i.e.,
?key=value
).
- Applicable to standard URL parameter formats, such as
-
Error Tolerance:
- If the specified parameter does not exist in the URL, the output will be an empty string.
- Automatically ignores invalid parts of the URL, such as undefined special characters or improperly formatted parameters.
Module Tutorial
1. Module Configuration
-
Add Module:
- Drag the URL Parameter Module into the workspace.
-
Fill in the
Name
Field:Name
specifies the name of the URL parameter to be extracted (i.e., thekey
inkey=value
).- Example: To extract the
query
parameter fromhttps://example.com?query=test
, enterquery
in theName
field. - The
Name
field is required.
-
Set Default Value (Optional):
- Enable the
default value
option to specify a default value for the parameter. If the parameter is not provided in the URL, the module will return the default value.
- Enable the
-
Parameter Naming Rules:
- Parameter names can only contain lowercase letters (
a-z
), numbers (0-9
), and underscores (_
). - Length range: 1-64 characters.
- Parameter names can only contain lowercase letters (
2. Input Data
Pass the target URL as a string to the module. The URL must include a query string in the format https://example.com?key=value
.
3. Output Data
- Output Format:
- The module outputs the extracted parameter value as a
String
.
- The module outputs the extracted parameter value as a
- Special Cases:
- If the specified parameter does not exist in the URL, the output will be an empty string.
- If the parameter has multiple values, the module will only return the first value.
Usage Examples
-
Dynamically Extract User Search Keywords:
- URL:
https://example.com/search?query=machine+learning&page=1
- Configuration:
Name
:query
- Output:
machine learning
- URL:
-
Extract User ID:
- URL:
https://example.com/profile?user_id=12345&lang=en
- Configuration:
Name
:user_id
- Output:
12345
- URL:
-
Retrieve Pagination Information:
- URL:
https://example.com/data?category=science&page=10
- Configuration:
Name
:page
- Output:
10
- URL:
Parameter Constraints and Rules
-
Parameter Naming Rules:
- Parameter name length range: 1-64 characters.
- Allowed characters: lowercase letters (
a-z
), numbers (0-9
), and underscores (_
). - Special characters (e.g.,
@
,#
,%
, etc.) are not supported.
-
Input URL Format Requirements:
- The URL must include a valid query string part (i.e.,
?key=value
). - Extraction from the path part or fragment (e.g., the part after
#
) is not supported.
- The URL must include a valid query string part (i.e.,
Notes
-
Single Parameter Limitation:
- Each module instance can only extract one URL parameter. To extract multiple parameters, add separate instances for each.
-
Role of Default Values:
- Setting a default value in the
default value
field prevents empty outputs due to missing parameters.
- Setting a default value in the
-
Output Data Type:
- The output data type of the module is fixed to
String
and cannot be changed.
- The output data type of the module is fixed to