Use Case: business requirement is to create one API proxy which serve/manage 3 back end services calls.
Business Flow: When a "POST" request containing json payload is sent "First Service" using through postman. we suppose to retrieve a value (value will be "Yes" or "No") from response. we have to put a condition like if the value is "Yes" then "Second Service" should be called and Second Service response should be sent to client (Postman). If the value is "No" then "Third Service" should be called and Third service response should be sent to client (postman).
I have tried below approach
1. Created an API proxy whose target endpoint is "First Service" under PreFlow
2. Created an "service callout" policy whose endpoint is "Second Service" under target endpoint response flow.
3. I haven't implemented conditional based flow yet, but directly calling "Second Service" in target endpoint response flow but getting empty response.
Can you please suggest what would be best solution to implement this type of scenario.
Thanks
Did you try proxy chaining from First to Second or Third service? That may be simpler and more efficient compared to service callouts
Hi Nagashree,
Thanks for reply, I haven't tired proxy chaining but is it possible through proxy chaining?
After First Service --> extract Response from First Call ---> Condition --> calling Second Service or Third Service. Is this possible in single Proxy call ?
Please advice..
proxy chaining involves multiple API proxies. Your usecase seems to be an orchestration requirement. check this, it might help you to chose the best solution for your usecase - https://community.apigee.com/questions/44704/proxy-chaining-vs-service-callouts.html
I suggest :
It looks like this
<Preflow> <Request/> <Response> <Step> <Condition>response.content = "Yes"</Condition> <Name>ServiceCallout-Service2</Name> </Step> <Step> <Condition>response.content = "No"</Condition> <Name>ServiceCallout-Service3</Name> </Step> ...