Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

I need help with creating a route rule - resources

Not applicable

My base url is https://org.apigee.net/base which covers https://myrealurl.com/v1

I want to add different endpoints like /plants which would cover https://myrealurl.com/v1/plants.json

I cannot figure out how to do this. Do I create a route rule? If so, can you please provide me with the exact code and where to place it.

This is not working.

<RouteRule name="plants"> <Condition>(proxy.pathsuffix MatchesPath "/plants") and (request.verb = "GET")</Condition> <URL>https://myrealurl.com/v1/plants.json</URL></RouteRule>
Solved Solved
1 10 3,453
1 ACCEPTED SOLUTION

You should have an API Proxy bundle.

Within that, a single API Proxy endpoint, with basepath /base

Within that, 2 flows. One with a condition like

<Condition>(proxy.pathsuffix MatchesPath "/plants") and (request.verb = "GET")</Condition>

Another with no condition. This second is your "default" flow, and we'll use it to catch invalid requests.

Then have one target, which uses https://myrealurl.com/v1/plants.json as the target url. One last twist: use an AssignMessage to tell Apigee Edge to NOT append the inbound pathsuffix to the outbound request.

Here's a screencast showing how to construct it, interactively.

6134-screenshot-20171212-140712.png

Here's a working API proxy that does what you want, the output of the exercise I went through above:

myfirst-rev1-2017-12-12.zip

View solution in original post

10 REPLIES 10