Any possibility to have two basepath for single proxy ?

Not applicable

Hi team,

I am trying to alow below base path for single proxy. [/v1/data*].

base path 1: /v1/data/

base path 2: /v1/dataTeam1/

base path 3: /v1/dataTeam2/

Aiming provide different url and configure different endpoint for single proxy.

I have a restriction, the basepath cannot be like /v1/data/Team1/ , /v1/data/Team2/

Please let me know if there is any possibility.

Thanks,

Satheesh.K

Solved Solved
3 33 7,021
1 ACCEPTED SOLUTION

Dear @kumarsathe ,

Yes, It's possible. Just add multiple proxy endpoints in single proxy. For example, please find attached proxy.

multibasepath-rev1-2016-03-30.zip

2294-screen-shot-2016-03-31-at-113633-am.png

Similarly, You can create multiple target endpoints within single proxy & use route rules to route traffic as needed.

View solution in original post

33 REPLIES 33

Dear @kumarsathe ,

Yes, It's possible. Just add multiple proxy endpoints in single proxy. For example, please find attached proxy.

multibasepath-rev1-2016-03-30.zip

2294-screen-shot-2016-03-31-at-113633-am.png

Similarly, You can create multiple target endpoints within single proxy & use route rules to route traffic as needed.

Hi Anil,

Here the problem is not endpoint. its a basepath. i want to allow basepath like below to one proxy [/v1/data*].

https://apigee.net/v1/data

https://apigee.net/v1/dataTeam1

https://apigee.net/v1/dataTeam2

Thanks,

Satheesh.K

Did you try Anil's bundle? Based on my understanding of what you're looking to get, the bundle does exactly that.

2287-untitled.png

Please check @Anil Sagar 's bundle, I believe it serves well your requirement.

Hi @Anil Sagar, @Carlos Eberhardt, @Sunandita Dam

I tried the same approach but am unable to have same Response cache in all those three proxyEndpoint xml. I get below error,

{

"code" : "steps.cache.ResponseCacheStepAttachmentNotAllowedReq",

"message" : "Response cache step definition c1_rescache_by_header_uri can not be attached more than once in the request path",

"contexts" : [ ]

}

Why it is so, those are two different ProxyEndpoint xml, and when one ProxyEndpoint executes, other will not come into picture, how it becomes duplicate of caching policy?.

Hi @Anil Sagar, @Sunandita Dam @ @Carlos Eberhardt

I tried the same approach but am unable to have same Response cache in all those three proxyEndpoint xml. I get below error,

{

"code" : "steps.cache.ResponseCacheStepAttachmentNotAllowedReq",

"message" : "Response cache step definition c1_rescache_by_header_uri can not be attached more than once in the request path",

"contexts" : [ ]

}

Why it is so, those are two different ProxyEndpoint xml, and when one ProxyEndpoint executes, other will not come into picture, how it becomes duplicate of caching policy?.

@Ameenun Try to add your bundle code. Problem lies somewhere else. It might be the case for same endpoint you added response cache policy more than once.

@Sunandita Dam since i cannot give my project code, I have now tried a new one, and attched the zip.

content-rev1-2016-06-22.zip

@Ameenun I made one change then it's not giving the problem mentioned by you. Just check.2983-content-rev1-2016-06-22-rev1-2016-06-22.zip

@Sunandita Dam You are creating one more policy, which doesn't solve the problem. If I have 10 different base paths, then i end up copying same policy 10 times with different name, This is a bug in the product.

@Ameenun I agree..looks like a bug. Hope someone has taken note of it.

Can you log a defect with your system, this fix would help us in reducing number of proxy we are writing.

I view the ResponseCache as the "easy-button" for caching. As such it may be designed to expect a single proxy endpoint. You can likely accomplish what you want using the more fine-grained cache policies. Lookup, Populate, etc. The same lookup policy can be attached to all three proxy endpoints. You could then use conditional steps to return the cached value or populate when there's a cache miss.

@Carlos Eberhardt Response policy does store headers, cookies and body all together, so if i wanna do the same with cache-policies, what "source" i should mention in the cache policies?.

Hi Anil,

How can we deploy multiple proxy endpoints from cmd

Right now I am able to deploy only one. using Apigee Edge deploy.py script

@rsekhar , You mean multiple API Proxies at once ?

Yes, Multiple proxy endpoints in same proxy

@rsekhar , I believe when you deploy proxy all the endpoints are deployed along with it.. Are you using any specific tool to deploy instead of Management UI ?

I am using python script to deploy

I am using python script to deploy

@rsekhar , I think script needs to be updated so that it will deploy all proxy end points.. can you point me to the script you are talking about ?

I am using below script to upload my files into apigee

https://api.enterprise.apigee.com/v1/organizations/{org-name}/apis?action=import&name={proxy-name}

and

below url for deploy my proxies

https://api.enterprise.apigee.com/v1/organizations/{org-name}/apis/{api-name}/deployments'?action=deploy&env={env}&revision={version-of-proxy}&basepath={base-path}

I import files like below

apiproxy/programs-programs.xml

apiproxy/policies/Response-Cache-1.xml

apiproxy/policies/Invalidate-Cache-1.xml

apiproxy/proxies/programsV1.xml

apiproxy/proxies/default.xml

apiproxy/policies/Verify-API-Key.xml

apiproxy/policies/JSON-Threat-Protection.xml

apiproxy/policies/Auth-Key.xml

apiproxy/policies/Add-Auth-Header.xml

apiproxy/policies/Quota-1.xml

apiproxy/policies/Spike-Arrest.xml

apiproxy/policies/Raise-Fault-1.xml

apiproxy/policies/Regular-Expression-Protection.xml

apiproxy/targets/BOD-Programs-programs-v1-EndPoint.xml

Kindly advise me

I am using Apigee Edge deploy.py script

If you want my script file. kindly tell me

Hi Anil,

Thanks, I resolved my issue and now I able to deploy more than one proxy end points

@rsekhar , Glad to know, Would you like to share the solution with community in a separate thread ? I am sure, It will be helpful for others.

Not applicable

Hi @kumarsathe,

I am curious to know how single proxy bundle is going to help for different base path. Could you elaborate the use case.

Assuming that given example given is to explain the requirement and it's really not the implementation.

Best Regards,

Rajesh Doda

Not applicable

I am using python script to deploy

Not applicable

@Anil Sagar

Is it possible to have two basepaths for single proxy without having to create multiple proxy endpoints?

I need this as I don't want to duplicate the endpoints. The only difference in both the endpoints will be the basepath

My use case is - I am having version as part of basepath and I am extracting the version number using a policy.

I only want to modify the response based on the version, so is it possible to do that using 2 basepaths for the same proxy?

Is it possible to have two basepaths for single proxy without having to create multiple proxy endpoints ? - NO

What do you mean "I need this as I don't want to duplicate the endpoints." ? And why you don't want to create multiple proxy endpoints in single proxy ?

@Anil Sagar

I am not against creating multiple proxy endpoints but it seems like a lot of duplicate work for a small change. I only want to modify response based on version(version is part of basepath) and if I have multiple proxy endpoints, every time I need to change something in a proxy, I have to change in both the places

Hello, I have a slight variation of this problem.

Over a period of time, my proxy has grown leaps and bounds and has more than 100 APIs. I was wondering if there is a way to better manager this volume with the constraint that we need to keep the basepath still the same. thanks

if you have 100 APIs in one proxy then its a bad code.

You should have made the proxies short and simple.

Having basepath the same is fine till you have minor changes at the backend. Its is suggested to do versioning whenever there is a major change in the backend.

100 APIs is probably way too many, especially if there's not a lot of shared logic amongst them.

One way you could split your APIs is to create new API proxies with more "specialised" basepaths.

Eg: If your original API has /basepath as the basepath and handles /suffix1 and /suffix2 in conditional flows, you could create 2 API proxies, one with basepath /basepath/suffix1, the other with basepath /basepath/suffix2. Your API clients won't notice any difference.

If those two suffixes share some common logic, you can factor this out in a shared flow invoked by your new 2 API proxies