【问题标题】:How do I call 2 endpoints with one proxy in Apigee?如何在 Apigee 中使用一个代理调用 2 个端点?
【发布时间】:2014-10-21 04:10:33
【问题描述】:

您好,我在这里尝试通过一个代理调用两个不同的端点。

第一个端点:基本上它是我编码到 .js 文件中的 java 脚本 第二个端点:这是一个端点,我必须将请求发送到第三方 URL 并获取响应并返回。

所以我想在我的查询字符串中发送一个参数,如下所示:

http://[url to my apigee proxy]/endpoint?stub=true

如果这是 url,那么它应该转到我的 JavaScript 代码。如果这是网址:

http://[url to my apigee proxy]/endpoint?stub=false

然后它应该转到第三方网址。我已经看过并尝试实现这一点; http://stackoverflow.com/questions/22783986/one-api-proxy-calling-two-different-target-endpoints 但它不适合我。

任何建议将不胜感激。

【问题讨论】:

  • 您粘贴的链接就是答案。您能否详细说明您在使用这种方法时面临的问题?
  • 它总是路由到 target1 吗?你看到了什么行为?
  • 嗨@Srikant 这是我所做的,但它对我不起作用:<RouteRule name="routeToTarget2"> <Condition>thetype == "xyz"</Condition> <TargetEndpoint>target2</TargetEndpoint> </RouteRule> <RouteRule name="routeToTarget1"> <TargetEndpoint>target1</TargetEndpoint> </RouteRule>
  • 嗨 @Srikanth 我刚刚添加了我的 apigee UI 的屏幕截图

标签: javascript apigee


【解决方案1】:

您缺少的目标端点。请加target endpoint xml。还请查看samples,它将帮助您了解附带文档。

【讨论】:

  • 我已经尝试添加目标endpoint.xml,但它根本不起作用
猜你喜欢
  • 2023-04-01
  • 2020-09-30
  • 2014-05-20
  • 2014-05-12
  • 2014-10-24
  • 2014-01-28
  • 2014-03-17
  • 2017-07-26
  • 1970-01-01
相关资源
最近更新 更多