Closed rkarwacki closed 7 years ago
Currently, as described in the documentation, there is a possibility to define custom query parameters from configuration files.
This solution is not flexible, because it is not possible to change the parameters without re-configuring Knot.X.
Consider this snippet (using un-escaped quotes indata-knotx-params for readability, instead of "):
data-knotx-params
"
<script data-knotx-knots="services,handlebars" data-knotx-service="parametrized-service" data-knotx-params="{'parameter1': 'value1','parameter2': 'value2'}" type="text/knotx-snippet">
And configuration fragment:
{ "name": "parametrized-service", "address": "knotx.adapter.service.http", "params": { "path": "/external/service" } }
The presented fragment should cause a call to:
/external/service?parameter1=value1¶meter2=value2
What is essential, in this approach we can change the parameter value dynamically using an outside system:
data-knotx-params="{'items': '${model.numberOfItemsToBeLazyLoaded}'}"
Hi @rkarwacki , please see #296 . This feature adds possibility to pass additional query parameters and headers to the service (also via data-knotx-params).
Currently, as described in the documentation, there is a possibility to define custom query parameters from configuration files.
This solution is not flexible, because it is not possible to change the parameters without re-configuring Knot.X.
Consider this snippet (using un-escaped quotes in
data-knotx-params
for readability, instead of"
):And configuration fragment:
The presented fragment should cause a call to:
What is essential, in this approach we can change the parameter value dynamically using an outside system: