What is the best way to call one API proxy from another API proxy ?

Let's say I have two API proxies

proxy1

-> resource1

-> resource2

proxy2

-> resource3

-> resource4

If I want to call "proxy2" from "proxy1". Or to be more precise I want to call "proxy3->resource3" from "proxy1->resource1".

As per the Service Callout policy documentation -> http://apigee.com/docs/api-services/reference/service-callout-policy, it says

"One consideration with the Service Callout policy is that you should not use it to make requests to other API proxies in the same organization, including recursive callouts back into the same API proxy. "

So, what are the other ways to do this ? If there are multiple ways, which is best way to do this ?

Solved Solved
0 12 2,933
1 ACCEPTED SOLUTION

adas
Participant V

@AMAR DEVEGOWDA The best way would be to use proxy chaining in this case. Please find the below article on the recent proxy chaining feature that we introduced in Edge: https://community.apigee.com/content/kbentry/10959/apigee-edge-adds-proxy-chaining-support-internal-...

Kindly note, this is in internal-beta at this stage.

View solution in original post

12 REPLIES 12

adas
Participant V

@AMAR DEVEGOWDA The best way would be to use proxy chaining in this case. Please find the below article on the recent proxy chaining feature that we introduced in Edge: https://community.apigee.com/content/kbentry/10959/apigee-edge-adds-proxy-chaining-support-internal-...

Kindly note, this is in internal-beta at this stage.

@arghya das,

Thanks a lot for informing about this new feature. It will certainly address my requirement.

a) Is there a limit on the number of proxies that can be chained ?

b) Since you are saying this new feature is still in beta, is there any other mechanism currently available that addresses my requirement ?

@AMAR DEVEGOWDA

There's no such limit unless you set the following property in the MP's http.properties:

# Max number of times the request can be routed through a gateway

# 0 means disabled. Defaults to 0.

HTTPClient.max.circular.ref.count=0

Proxy chaining as a feature itself has been there since the beginning, what we have introduced in this feature is to call the chained proxy via localhost thereby eliminating the network hop.

localhost = lands on router or Mp? Can you elaborate on that? @arghya das

The MP calls itself and doesn't go out to the public domain, resolve DNS or come via the router. Since the runtime policy execution and target routing happens in the MP, the calls do not go out of the MP when you call proxy-chaining.

@arghya das Unable to reply you in the comments.

how does that work? a default VH that listens on Mp too and how does classification happen? Can you explain the logic if possible?

@arghya das I am not able to access the link (Access denied). Is it for internal purpose only as of now??

@Vipul Agarwal Sorry about that. Now you should be able to access it.

@arghya das Ok. No Problem. Can you please help in understanding the best practices for such use cases.?

Here are some useful links:

best practices api proxy design and development

https://community.apigee.com/questions/1260/api-chaining.html

Let me know, if you need any other information.

adas
Participant V

@Maruti Chand Can you go through the KB article: https://community.apigee.com/content/kbentry/10959/apigee-edge-adds-proxy-chaining-support-internal-...

Basically, both the proxies are deployed on the same virtualhost and env, so the MP is able to classify the request based on the path or apiproxy name and proxy endpoint name combination.

@arghya das missed that article . thanks for pointing me to that.