Course 1: Getting started with API AutoFlow
2 min read · 5 min video
Lesson 4: Build Your First Flow Using Conditionals
Now that you have a good grasp of the fundamentals, let’s look at how to create more complex solutions.
The conditionals are statements like IF, Match, the Switch that perform a set of actions when the conditions are met.
If you had any interest in technology, I am sure you have come across the “IF” condition (no pun intended).
“Match” is similar in a way that instead of true
or else
, it has a list of conditions.
Lesson Outline
- Apply
Conditional
action to theflow
- Set condition rule
- Apply actions to the conditions
1. Apply Conditional
action to the flow
From the right navigation
, select the conditional
category.
Drag and drop the IF
condition to the flow
2. Set condition rule
Select the IF
action and use the drop-down to set the condition.
In the below example, we are selecting the string/contains
a condition. String/contains checks whether the target
contains a certain string
value.
Let’s set the target as request/body
.
If the target request/body
contains a string
value “Hello”, the condition is true
, otherwise, it is else
.
To test the solution, you can use the flow test simulation
to mock the request/body
.
3. Apply actions to the conditions
In the true
part of the IF condition, apply the data/set
action.
- Make the value “True”
- Make the output as “response/body”
You will notice that since the condition is true, it will execute the action “data/set” to return the value “True”
Download Build Your First Flow Using Conditionals configuration
Learn how to use configurationNEXT » Lesson 5: Master Loops(Iterations) to Create Complex Solutions