【问题标题】:What is the best practice to transform the path between proxy and target in apigee?在 apigee 中转换代理和目标之间的路径的最佳做法是什么?
【发布时间】:2016-06-30 14:44:20
【问题描述】:

我正在代理端点发出请求 /Patient/1,我想将其转换为目标端点 /openemr/api。我尝试了https://community.apigee.com/articles/2793/how-to-geo-locate-calls-to-target-endpoint.html 中给出的解决方案,但这些都不适合我。请提出实现此目标的最佳方法。

提前致谢。

【问题讨论】:

    标签: apigee


    【解决方案1】:

    这取决于您必须实施多少次重新路由。所以在 5+ 的情况下,使用 javascript 策略,例如:

    var reqPathsuffix = context.getVariable("proxy.pathsuffix");
    var reqVerb = context.getVariable("request.verb");
    
    if ((reqPathsuffix === "/contact") && (reqVerb === "GET"))
    {
        endPointURL = "https://yourendpointurl/
    }
    context.setVariable("target.url",endPointURL);
    

    否则可能会使用“AssignMessage”策略。

    <AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Message-1">
      <AssignTo createNew="false" transport="http" type="request"/>
      <AssignVariable>
        <Name>target.url</Name>
        <Value>http://google.nl</Value>
      </AssignVariable>
    

    不要忘记在“目标端点预流请求”流程上执行此操作。否则将无法正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-09
      • 1970-01-01
      • 1970-01-01
      • 2014-06-17
      • 1970-01-01
      • 2020-05-27
      • 1970-01-01
      相关资源
      最近更新 更多