1. Create your first flow
Get started by dropping aRequest node onto the canvas. This node allows you to send a HTTP Request.
2. Lets iterate
Its very common that you need to iterate or loop through the results of an array when dealing with APIs.- Drag the
Transformnode onto the canvas and connect it to theRequestnode - The
Transformnode can operate in a few different modes. For this example, we will use theiteratemode. - Paste the variable
{{1_Request.body}}into the Array path setting. This tells Zygo that we want to iterate over the body of the Request. - Go ahead and hover over the
Requestnode and hit the play button - You will now see X number of events that are emitted from the
Transformnode. Lets move onto a conditional node!
3. Learning conditionals
So far we have sent a GET request using theRequest node and iterated over the results with the Transform (iterate mode) node. Now we want to check each object in the array for specific values so we handle the data differently. The Condition node (if / else) allows us to create one or many rules in order to “route” the flow one way or another.
- Drag the
Conditionnode onto the canvas and attach it to theTransformnode. - Click on the indicator in the top right of the
Transformnode to pull up the events panel. - We are going to check if any object in the array has more than 8000 employees. So we want to copy the reference to
{{item.employeeCount}} - Paste
{{item.employeeCount}}into the first rule, specifygreater thanand then insert8000. - Now we are going to use two more nodes and connect them to the
Conditionnode so we can easily see which path if followed.- Drag a
Transformnode onto the canvas and connect it to theConditionnode - Drag another
Transformnode onto the canvas. But now hover over theConditionnode, click theSet Failure Pathbutton and then connect it. The failure path will be followed if the rule does not match
- Drag a
- Go ahead and hover over the
Requestnode and hit the play button- You will notice that some objects with flow towards one end node and other events will follow the failure path