is there a way in apigee to handle multiple endpoint efficiently rather hard coding for each resource call with assign message policy at target end point?
Solved! Go to Solution.
Hi Kuldeep - If you're wanting to set up dynamic routing to different endpoints, check out this topic: http://apigee.com/docs/api-services/reference/api-proxy-configuration-reference
To add to Floyds reference - you can use any information you have available in the request - query params, headers, uri, etc to create route rules to target servers.
We have a client that requires that different target servers be invoked based on regions around the globe. In that case they have a URI structure that includes a couple of variables that we use in RouteRules.
For example the URI path of /us/v1/profile/me/catalog/foo/123 will route traffic to a different target server than /uk/v1/profile/me/catalog/foo/123. The variables for this are resolved in an extract policy that looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <ExtractVariables async="false" continueOnError="true" enabled="true" name="extractCatalogVariables"> <DisplayName>extractCatalogVariables</DisplayName> <Variable name="request.uri"> <!-- work from most specific to least specific--> <Pattern>/{region}/{version}/profile/*/catalog/{catalog.type}/{catalog.id}</Pattern>
Route rules in the default proxy flow then can make decisions about where to send the target request using the region variable:
<RouteRule name="catalog-us"> <Condition>(region == us)</Condition> <TargetEndpoint>catalog-us</TargetEndpoint> </RouteRule>
Could you please elaborate your question a little bit more. Are you asking how to define a single api proxy with different proxy endpoint or a single proxy routing to different targets endpoints based on some condition?
Divya,
Thanks for the response, I in fact meant first - "how to define a single api proxy with different proxy endpoint", but do not see any harm in knowing second one as well ๐
Kuldeep,
In order to define a single apiproxy, you need to first create an apiproxy with some basepath.
Once the apiproxy is created, you then need to add a 'New Endpoint' under the proxy endpoint section.
In the new Proxy endpoint you would need to define the Basepath of this new Proxy endpoint.
Attached is the screenshot.
Hi Kuldeep - If you're wanting to set up dynamic routing to different endpoints, check out this topic: http://apigee.com/docs/api-services/reference/api-proxy-configuration-reference
To add to Floyds reference - you can use any information you have available in the request - query params, headers, uri, etc to create route rules to target servers.
We have a client that requires that different target servers be invoked based on regions around the globe. In that case they have a URI structure that includes a couple of variables that we use in RouteRules.
For example the URI path of /us/v1/profile/me/catalog/foo/123 will route traffic to a different target server than /uk/v1/profile/me/catalog/foo/123. The variables for this are resolved in an extract policy that looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <ExtractVariables async="false" continueOnError="true" enabled="true" name="extractCatalogVariables"> <DisplayName>extractCatalogVariables</DisplayName> <Variable name="request.uri"> <!-- work from most specific to least specific--> <Pattern>/{region}/{version}/profile/*/catalog/{catalog.type}/{catalog.id}</Pattern>
Route rules in the default proxy flow then can make decisions about where to send the target request using the region variable:
<RouteRule name="catalog-us"> <Condition>(region == us)</Condition> <TargetEndpoint>catalog-us</TargetEndpoint> </RouteRule>
thanks a lot @Divya Achan @David Allen @Floyd Jones
Hi I have similar type of question just like above. I am new to apigee, I want to place the API proxy on this platform for my API.
I wanted to take the parameter from the proxy url and change the Target endpoint path.
For Example.
http://proxy-server/{category}
to
Type a product name