简体   繁体   中英

How to add a URL parameter using a WSO2 Mediation Flow?

I have successfully deployed a WSO2 API Manager. I am already using mediation flows for setting Header information, but now I am adding an API that requires a key to be set as an URL parameter. However I would like this to be added in the background so that the end-users don't have to worry about this key.

How can this be done in a Message Mediation Policy/Flow? Obviously the other parameters that are already present should stay untouched.

Thanks in advance

Hope you can access the key inside the synapse context. Then you can assign the key value to the uri.var object as below.

<property name="uri.var.key" expression="get-property('userParames.key')"/>

Now you can simply construct the endpoint as,

<endpoint>
   <http uri-template="https://{uri.var.hostname}:{uri.var.portnum}/abc/{uri.var.key}"/>
</endpoint>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM