Flow condition route to target response

I'm new to apigee and would like to know the solution

I check a condition in flow statement and if true i should get the response from the Target.

If false it should throw an fault error code saying condition not met.

P.S: I'm checking this condition on the Proxy request flow .

Solved Solved
0 1 63
1 ACCEPTED SOLUTION

Use a RaiseFault Policy to set the error code and response.

<RaiseFault name="RF-ThrowError">
 <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
 <FaultResponse>
   <Set>
     <StatusCode>404</StatusCode>
     <ReasonPhrase>The resource requested was not found</ReasonPhrase>
   </Set>
 </FaultResponse>
</RaiseFault>
    <Step>
        <Name>RF-ThrowError</Name>
        <Condition> your condition = here </Condition>
    </Step>

<br>

If condition is true the error will be sent, if false then the Target will be invoked.

View solution in original post

1 REPLY 1

Use a RaiseFault Policy to set the error code and response.

<RaiseFault name="RF-ThrowError">
 <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
 <FaultResponse>
   <Set>
     <StatusCode>404</StatusCode>
     <ReasonPhrase>The resource requested was not found</ReasonPhrase>
   </Set>
 </FaultResponse>
</RaiseFault>
    <Step>
        <Name>RF-ThrowError</Name>
        <Condition> your condition = here </Condition>
    </Step>

<br>

If condition is true the error will be sent, if false then the Target will be invoked.