I want to activate a flow that will return a message if the status code isn't 200.
I use Apigee's mocktarget statuscode to mimic status code 400.
However, when I use trace I see two conditions, with the following expressions:
(((error.state equals TARGET_REQ_FLOW) or (error.state equals TARGET_RESP_FLOW)) or ((error.state equals REQ_SENT) or (error.state equals RESP_START)))
and
("default" equals target.name)
I have the following flow:
<PreFlow name="PreFlow"> <Request/> <Response> <Step> <Name>slack-alert-flow</Name> <Condition>response.status.code != 200</Condition> </Step> </Response> </PreFlow>
If the condition is true it should go to a shared flow with the following assign message policy:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="false" enabled="true" name="return-failure"> <DisplayName>return failure</DisplayName> <Properties/> <Set> <Payload contentType="text/plain">Your call failed</Payload> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="response"/> </AssignMessage>
How can I return the payload created in the assign message policy to the end user?
Solved! Go to Solution.
Hi @Friso Denijs, If the status code is => 400 it automatically goes to the fault rule, you either add your policies in the fault rules (http://docs.apigee.com/api-services/content/fault-handling) or you can add success.codes in your target endpoint definition as mentioned here http://docs.apigee.com/api-services/reference/endpoint-properties-reference
Hi @Friso Denijs, If the status code is => 400 it automatically goes to the fault rule, you either add your policies in the fault rules (http://docs.apigee.com/api-services/content/fault-handling) or you can add success.codes in your target endpoint definition as mentioned here http://docs.apigee.com/api-services/reference/endpoint-properties-reference
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |