apigee - Working around the wildcard limitation in defining hierarchical APIs -
suppose want create following apis:
/movies/{movieid}/cast /movies/{movieid}/crew /movies/{movieid}/awards
on recent versions of apigee, wildcards no longer allowed in base url. achieve ones above, first created api proxy /movies
. defined 3 separate resources under it, each starting wildcard:
/*/cast /*/crew /*/awards
here's couple of questions:
- is way define wildcards in hierarchical api structure?
- is there way define these 3 separate api proxies?
say created api basepath /movies , consume /movies/jaws/cast. can crate preflow policy extract path variable this:
<extractvariables async="false" continueonerror="false" enabled="true" name="extract-uri"> <displayname>extract uri</displayname> <faultrules/> <properties/> <uripath> <pattern>/{movieid}/{function}</pattern> </uripath> </extractvariables>
you have 2 variables, 1 variable , 1 actual service. can create conditional flow each function (cast, crew, awards...) on variable function rather matching path:
<flow name="cast"> <description/> <request/> <response> <step> <faultrules/> <name>assign-cast</name> </step> </response> <condition>(function = "cast") , (request.verb = "get")</condition> </flow>
you may still need magic rewrite target path, request proxy path still /jaws/cast can run specific policies against request cast of jaws.
see http://apigee.com/docs/api-services/api/conditions-reference , http://apigee.com/docs/gateway-services/content/flow-variables-and-conditions more info on conditional flow configuration.
Comments
Post a Comment