Skip to content

About

Gravitee Policy - Transform Query Parameters

Topics

Resources

Contributing

Stars

0 stars

Watchers

23 watching

Forks

Repository files navigation

Transform query parameters policy

Gravitee.io License Releases CircleCI

Phase

onRequest onResponse

X

Description

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

You can also append a value to an existing query parameter.

The query parameter values of the incoming request are accessible via the {#request.params['query_parameter_name']} construct.

Compatibility with APIM

Plugin version APIM version

Up to 1.6.x

3.x

1.7.x

4.0 to 4.7.x

2.x

4.8 to latest

Examples

Add the ID of the incoming request to the outgoing request

"transform-queryparams": {
    "addQueryParameters": [
        {
            "name": "myParam",
            "value": "{#request.id}"
        }
    ]
}

Remove existing param and add a new one

"transform-queryparams": {
    "removeQueryParameters": [
        "foo"
    ],
    "addQueryParameters": [
        {
            "name": "myParam",
            "value": "myValue"
        }
    ]
}

Remove all existing params and add a new one

"transform-queryparams": {
    "clearAll": true,
    "addQueryParameters": [
        {
            "name": "myParam",
            "value": "myValue"
        }
    ]
}

Replace an existing param

"transform-queryparams": {
    "addQueryParameters": [
        {
            "name": "myParam",
            "value": "myNewValue"
        }
    ]
}

Append multiple values to an existing param

"transform-queryparams": {
    "addQueryParameters": [
        {
            "name": "foo",
            "value": "bar2",
            "appendToExistingArray": true
        },
        {
            "name": "foo",
            "value": "bar3",
            "appendToExistingArray": true
        }
    ]
}

Replace an existing param with an array

"transform-queryparams": {
    "addQueryParameters": [
        {
            "name": "foo",
            "value": "bar2",
            "appendToExistingArray": false
        },
        {
            "name": "foo",
            "value": "bar3",
            "appendToExistingArray": true
        }
    ]
}

About

Gravitee Policy - Transform Query Parameters

Topics

Resources

Contributing

Stars

0 stars

Watchers

23 watching

Forks

Releases

Packages

Used by

Contributors

Languages