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

Darshan Hiranandani : Can One API Invoke Another API in the Same Proxy?

Hello everyone,

I am Darshan Hiranandani, I have set up a proxy called Test with the base path /test/v0, and it contains two APIs: API A and API B.

Here is the flow I am aiming for:

  1. A client calls API A.
  2. API A invokes API B and performs some additional processing.
  3. Once API B responds, API A sends the response back to the client.

Is it possible to implement this kind of setup? I would appreciate any advice or suggestions on how to achieve this, especially regarding how API A can invoke API B within the same proxy.

Looking forward to your insights!

Thank you in advance.

Regards

Darshan Hiranandani

0 1 102
1 REPLY 1

Hi @darshanhira24 !
There is a topic that is very similar to your questions.

Can-api-invoke-other-api-in-the-same-proxy 

Please read the information there, and come back in case you still have questions.
In this case, please clarify a few things, like

1. what do you mean as an "API", like API A and API B? those represent different APIs provided
by one/two different backends?
2. what do you mean "A client calls API A"? the client calls the Proxy, and some part of the message indicates that the request should be forwarded to the "backend API A"?
3. What do you mean "API A invokes API B"? the two backends communicate with each other?
4. please check the documentation of Service Callout policy , with this you can achive more than one southbound-communication instead of only 1
5. You can also consider implementing this logic in the client side, it would make a more simple proxy-flow

Best regards,
Marcelo