Each endpoint of your API can have its individual flow specified by
x-flat-flow, see Routing.
<flow><if test="$request/query = 42"><echo>Yeah, that's it!</echo></if><elseif test="$request/query"><echo>Um, no!</echo></elseif><else><echo>Do you know the answer?</echo></else></flow>
Response processing (such as validation and sending out the response) will continue, though.
break statement should usually be executed conditionally, because otherwise none of the following statements will ever be executed.
<flow><break/><echo>will never be reached</echo></flow>
if statement and the optional
else statements allow for conditional execution of flow blocks.
<flow><if test="…">…</if><if test="…">…</if><else>…</else><if test="…">…</if><elseif test="…">…</elseif><if test="…">…</if><elseif test="…">…</elseif><elseif test="…">…</elseif><else>…</else></flow>
Conditional expressions are defined in the
test="…" attributes of the
elseif statements. If such an expression evaluates to
true, the flow block inside that
elseif) will be executed. All directly following
else blocks will then be skipped.
If the result of that expression is
false, the block will be skipped and the condition of the following
elseif statement will be checked, if applicable.
The block associated with the first matching conditional expression will be executed – or if all expressions were evaluated to
else block will be executed.
return quits the current sub flow and returns to its parent flow. If
return is used in the init flow the regular API path flow will still be executed. A
return statement on the top-most flow behaves like