Came across below use case related to Api Proxy flows. As per flow diagram in Apigee docs, conditional flows can be attached to request / response pipelines.
I have a use case where i have created a new flow in Target Endpoint where my condition is execute the flow when response status code is 404. Interestingly, it doesn’t work.
Hey Anil - The condition might not be firing. Try replacing your “is” operator with “=” and see if that works. You can also try the response.status.code variable to see if that gives you any love.
I don’t think “is” is supported. I found a couple of examples in the docs where “is” was used, and I’ve changed those to “=”.
@Floyd Jones , It doesn’t work. I have also tried with response.status.code and result is same. Flow Condition executes for both request and response pipelines, response status code is not available when i compare against 404 code. What i would like to achieve is flow condition only on response pipeline. @Maruti Chand@sriki77@Madhan Sadasivam@Prashanth Subrahmanyam Any Idea ?
Hi @Anil Sagar , Do you have your success.codes set in the HTTPTarget connection ? else the execution flow goes to the fault handling right . Probably you missed it ?
@Maruti Chand , Yes you are right. Adding success.codes solved part of problem. Thank you!! Conditional flow now executes as expected. But other issue still i see is it still executes for both request & response pipelines. Above condition on request pipeline doesn’t make any sense. Question is can we have conditional flow only for response pipeline ?
Is Apigee API Proxy flow defined as , Client ->Target ->Client ?
Or Can i have two different conditional flows like , Client → Target , Target → Client ?
@Maruti Chand So , Are you saying Apigee Conditional flow always executes on both Request & Response pipelines no matter what ? Because if you see above flow diagram representation one can assume that a conditional flow can be attached only to response pipeline. Regarding #2, My issue is this condition executes in request pipeline too. Can we avoid this ? I mean execution , forget about policies. See below trace. My flow condition execute for both request & response pipeline.
So, Answer is : Is Apigee API Proxy flow defined as , Client ->Target ->Client ? Right ? We cannot have a condition flow only for response pipeline ? Right ?
Thanks, guys. @Anil Sagar, apologies for not fully understanding the need! I get what you’re asking now. So yes, the element is available only for the entire flow. Condition isn’t available inside or . So the condition is evaluated throughout the entire flow, whether or not there’s anything to execute if it evaluates to true.
I’m guessing the use case is that you want to execute things in the request based on one condition, and if you get a 404 in the response, do something else, correct?
@Floyd Jones , Yes, condition executes for both request and response. Ideally i would like to execute condition only on response. That’s not possible right now. No matter what condition executes in both request & response pipelines. In my case in request condition evaluates to false because response code doesn’t make sense in request pipeline. Can we add this information to doc ? Or Do you think it will confuse developers and let the documentation as it is ?