在WSO2 API Manger中有没有办法从请求xml / json(payload)中读取参数值,并根据该值将请求路由到不同的后端 endpoints ?
您可以尝试使用mediator扩展 .
API Manager具有其收到的API调用请求的默认中介流 . 您可以扩展此默认中介流以路由请求 .
<sequence xmlns =“http://ws.apache.org/ns/synapse”name =“YahooWeather2”><property name =“YQL”类型=“表达”表达=“的concat( 'Q =选择%20 *%20from%20weather.forecast%20where%20woeid%20英寸20%(选择%20woeid%20from%20geo.places(1)%20where%20text%3D%22',顺:获取属性( 'uri.var.zipcode'), '',顺:获取属性( 'uri.var.country'), '22%)格式= JSON')“/><property name =“REST_URL_POSTFIX”type =“Expression”expression =“get-property('YQL')”scope =“Axis2”/></序列>
要将序列文件上传到APIM,请以 admin 身份登录 main-> Resources-> Browse
从树视图转到 /_system/governance/apimgt/customsequences/in.
点击 Add Resource 上传您创建的序列文件 .
登录API Publisher,选择api并单击 edit 并转到 Manage 选项卡 .
单击 Check to select a custom sequence to be executed in the message flow 的复选框,并在 In Flow 下拉列表中选择您的序列(示例为 YahooWeather2 )并执行 Save & Publish .
登录API商店并订阅api并生成访问令牌 .
您可以在API商店中查看 API Console 的可用性 . 有关详细信息,请参阅https://docs.wso2.com/display/AM191/Change+the+Default+Mediation+Flow+of+API+Requests
1 回答
您可以尝试使用mediator扩展 .
API Manager具有其收到的API调用请求的默认中介流 . 您可以扩展此默认中介流以路由请求 .
要将序列文件上传到APIM,请以 admin 身份登录 main-> Resources-> Browse
从树视图转到 /_system/governance/apimgt/customsequences/in.
点击 Add Resource 上传您创建的序列文件 .
登录API Publisher,选择api并单击 edit 并转到 Manage 选项卡 .
单击 Check to select a custom sequence to be executed in the message flow 的复选框,并在 In Flow 下拉列表中选择您的序列(示例为 YahooWeather2 )并执行 Save & Publish .
登录API商店并订阅api并生成访问令牌 .
您可以在API商店中查看 API Console 的可用性 . 有关详细信息,请参阅https://docs.wso2.com/display/AM191/Change+the+Default+Mediation+Flow+of+API+Requests