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

Combining words and wildcards in API proxy base path

Not applicable

Hello Apigee Community!

I have 4 backend API endpoints:

  • /a/foo
  • /a/foo.json
  • /a/foo.xml
  • /a/bar

Preferably, I would like to configure 3 proxy endpoints in Apigee:

  • /a/foo/
  • /a/foo.*/
  • /a/bar/

Unfortunately, /a/foo* and /a/bar belong to completely different API proxies so I cannot put them in a single one.

In ticket https://community.apigee.com/questions/7404/can-wildcards-be-used-in-basepaths.html Dallen points that "the wildcard must be a full path element for the classification engine to work as expected".

Do I understand it correctly that I cannot combine words with wildcards in a single base path element (to get sth like /foo.*/)?

The most obvious workaround is to go with 4 proxy endpoints (for /foo, /foo.json, /foo.xml and /bar). However, if I would like in the future to add a new type in my backend, let's say binary, I would have to add another proxy endpoint (/foo.bin). Am I correct?

Thank you,

Andrzej

Solved Solved
4 15 4,062
2 ACCEPTED SOLUTIONS

@AndrzejDev ,

Very Interesting Question,

I have created two API Proxies with different base paths & different Target Endpoints.

  • /a/* -- Points to Target -- /a -- will be used for /a/foo , /a/foo.json, /a/foo.xml, /a/foo.bin
  • /a/bar -- Points to Target -- /a/bar

It works & classification happens as expected. @arghya das would you like to throw some light how exactly it happens even though request /a/bar also matches /a/* it hits /a/bar proxy instead /a/* ?

@AndrzejDev ,

You can have two API Proxies one with basepath /a/* & other with basepath /a/bar. Please find sample proxies that worked for me.

mockapi-rev1-2016-05-23.zip

mockapi2-rev1-2016-05-23.zip

Similarly , you can also have 3 proxy endpoints,

/a/foo , -- Points to Target -- /a/foo -- will be used for /a/foo

/a/* , -- Points to Target -- /a -- will be used for /a/foo.json, /a/foo.xml, /a/foo.bin

/a/bar, -- Points to Target -- /a/bar

View solution in original post

adas
New Member

@AndrzejDev my tests turned out quite well. I tried with 3 proxies: /apigee/v1, /apigee/* and /apigee/v2. I could hit each of them uniquely as long as the path was deterministic. When I undeployed /apigee/v1 I could see the /apigee/* proxy getting hit. Apart from that most of it worked fine. I made sure the sequence in which you deploy them doesn't matter as long as the wildcard is deterministic. So you might be good with this.

Do you also have a scenario where you want to use /apigee/*/test/*. I am not sure how that would work.

View solution in original post

15 REPLIES 15
Top Solution Authors