You can use the transform-queryparams policy to override incoming HTTP request query parameters.
You can override HTTP query parameters by:
- Clearing all existing query parameters
- Adding to or updating the list of query parameters
- Removing query parameters individually
You can also append a value to an existing query parameter.
Query parameter values of the incoming request are accessible via the {#request.params['query_parameter_name']} construct.
The transform-queryparams policy can be applied to the following API types and flow phases.
PROXYMESSAGELLM PROXY
- Request
Strikethrough text indicates that a version is deprecated.
| Plugin version | APIM | Java version |
|---|---|---|
| 2.x | 4.8.x to latest | 21 |
| 1.7.x | 4.0.x to 4.7.x | 17 |
Name json name |
Type constraint |
Mandatory | Default | Description |
|---|---|---|---|---|
Add or replace query parameteraddQueryParameters |
array | See "Add or replace query parameter" section. |
||
Clear all query parametersclearAll |
boolean | Please be aware that by clearing all query parameters, you mustn't be able to use them in expression language. | ||
Remove query parametersremoveQueryParameters |
array (string) |
Name json name |
Type constraint |
Mandatory | Default | Description |
|---|---|---|---|---|
Append the value to existing queryParam as an array (i.e. ?key=v1&key=v2&key=v3) ?appendToExistingArray |
boolean | |||
Namename |
string | ✅ | ||
Value. (Supports EL)value |
string | ✅ |
Add, update and remove query parameters
{
"api": {
"definitionVersion": "V4",
"type": "PROXY",
"name": "Transform Query Parameters example API",
"flows": [
{
"name": "Common Flow",
"enabled": true,
"selectors": [
{
"type": "HTTP",
"path": "/",
"pathOperator": "STARTS_WITH"
}
],
"request": [
{
"name": "Transform Query Parameters",
"enabled": true,
"policy": "transform-queryparams",
"configuration":
{
"addQueryParameters": [
{ "name": "added", "value": "addedValue" },
{ "name": "toUpdate", "value": "updatedValue" }
],
"removeQueryParameters": ["toRemove"]
}
}
]
}
]
}
}
Clear all and add a new query parameter
{
"api": {
"definitionVersion": "V4",
"type": "PROXY",
"name": "Transform Query Parameters example API",
"flows": [
{
"name": "Common Flow",
"enabled": true,
"selectors": [
{
"type": "HTTP",
"path": "/",
"pathOperator": "STARTS_WITH"
}
],
"request": [
{
"name": "Transform Query Parameters",
"enabled": true,
"policy": "transform-queryparams",
"configuration":
{
"clearAll": true,
"addQueryParameters": [{ "name": "added", "value": "addedValue" }]
}
}
]
}
]
}
}
Append values to an existing query parameter
{
"api": {
"definitionVersion": "V4",
"type": "PROXY",
"name": "Transform Query Parameters example API",
"flows": [
{
"name": "Common Flow",
"enabled": true,
"selectors": [
{
"type": "HTTP",
"path": "/",
"pathOperator": "STARTS_WITH"
}
],
"request": [
{
"name": "Transform Query Parameters",
"enabled": true,
"policy": "transform-queryparams",
"configuration":
{
"addQueryParameters": [
{ "name": "appended", "value": "value1", "appendToExistingArray": true },
{ "name": "appended", "value": "value2", "appendToExistingArray": true }
]
}
}
]
}
]
}
}
2.0.0 (2026-05-06)
- deps:: update gravitee-parent to v23.5.0 (530c5b4)
- enable the policy for LLM_PROXY APIs (8862a77)
- deps:: requires Java 21
1.9.0 (2023-12-19)
- enable policy on REQUEST phase for message APIs (5d080cd), closes gravitee-io/issues#9430
1.8.0 (2023-12-01)
- add an option to handle array of values in a query parameter (253127b)
1.7.1 (2023-07-20)
- update policy description (91bc7bd)
1.7.0 (2023-07-05)
- addition of the execution phase (9061fa3)