Hi, could someone provide me with a simple example of how to setup a Proxy Endpoint with a Conditional Flow and then change the URL.
What I want is to call a specific URL and not add the Conditional Flow criteria to the called URL.
Conditional targets may be simpler than using a conditional flow to change the target. Check out the example listed on the page describing how routing works: http://docs.apigee.com/api-services/content/understanding-routes#determiningtheurlofthetargetendpoin...
Thanks for the response Carlos, however I still cannot seem to get this working because it still amends the resource-path to the target URL.
i.e. http://myapi.apigee.net/base-api/service1 targets incorrectly to http://mycompany.com/api/anotherservice/service1
Here is the relevant section from the XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="default">
<RouteRule name="service1">
<Condition>(proxy.pathsuffix MatchesPath "/service1") and (request.verb = "GET")</Condition>
<URL>http://mycompany.com/api/anotherservice</URL>
</RouteRule>
What I need is the following
http://myapi.apigee.net/base-api/service1
http://mycompany.com/api/anotherservice
So the target URL has no resemblance to the proxy URL
We want to completely mask the backend services into a rebranded service.
Anil's answer should cover that, however it will stop the entire path from being appended. I don't know if we have enough info to provide a complete answer. Do you have two different backends you want to appear under /base-api/service1 and /base-api/service2? If that's the case why not two proxies?
If you don't want to copy proxy path suffix & query params to target , you need to set below variables to false using Assign Message Policy or Javascript policy in target request flow.
target.copy.pathsuffix=false target.copy.queryparams=false
You cannot use hardcoded URLs for your use case since you need to set above variables in target request flow, Create a new targetendpoint & use same in route rules. See example proxy below.
nocopytarget-rev1-2016-09-27.zip
http://anildevportal-test.apigee.net/base-api/json1 -> http://mocktarget.apigee.net/json
Proxy BasePath : /base-api
Proxy PathSuffix : /json1
Target EndPoint : http://mocktarget.apigee.net/json
As you can see in above attached proxy, Path suffix is not carried over to target endpoint.
Hope it helps.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |