简体   繁体   English

如何使用WSO2中介流添加URL参数?

[英]How to add a URL parameter using a WSO2 Mediation Flow?

I have successfully deployed a WSO2 API Manager. 我已经成功部署了WSO2 API管理器。 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. 我已经在使用中介流来设置标头信息,但是现在我添加了一个API,该API要求将密钥设置为URL参数。 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. 然后,您可以将键值分配给uri.var对象,如下所示。

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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