description |
---|
This page provides the technical details of the Transform Query Parameters policy |
You can use the transformqueryparams
policy to override incoming HTTP request query parameters. You can override the HTTP query parameters by:
- Clearing all existing query parameters
- Adding to or updating the list of query parameters
- Removing query parameters individually
The query parameter values of the incoming request are accessible via the {#request.params['query_parameter_name']}
construct.
Functional and implementation information for the transformqueryparams
policy is organized into the following sections:
{% hint style="warning" %} This policy can be applied to v2 APIs and v4 HTTP proxy APIs. It cannot be applied to v4 message APIs or v4 TCP proxy APIs. {% endhint %}
{% tabs %} {% tab title="HTTP proxy API example" %} The example below shows how to add the ID of the incoming request to the outgoing request:
"transform-queryparams": {
"addQueryParameters": [
{
"name": "myParam",
"value": "{#request.id}"
}
],
"removeQueryParameters": [
"secretParam"
]
}
{% endtab %} {% endtabs %}
The phases checked below are supported by the transformqueryparams
policy:
v2 Phases | Compatible? | v4 Phases | Compatible? |
---|---|---|---|
onRequest | true | onRequest | true |
onResponse | false | onResponse | false |
onRequestContent | false | onMessageRequest | false |
onResponseContent | false | onMessageResponse | false |
The following is the compatibility matrix for APIM and the transformqueryparams
policy:
Plugin Version | Supported APIM versions |
---|---|
1.x | All |
{% @github-files/github-code-block url="https://github.com/gravitee-io/gravitee-policy-transformqueryparams/blob/master/CHANGELOG.md" %}