Understanding nodes
What is a node
A node is a single action that can be performed in your API endpoint. Each node is a self-contained unit of functionality, and you can connect nodes together to build your API functionality.
Add a node
Go to your cloudspace to start adding nodes to your flow. you can click on the plus icon in the bottom-right corner to open a list of all available nodes to add from, once the nodes list
is open you can choose any node you want to add, configure its options and click on Done.
Your endpoint will always start running from the start
node, so you need to connect your start
node's next property
with the first node you want to run in your endpoint.
You need to notice few things:
The
start
node will be always built-in with any endpoint you create.If you delete the
start
node ,the endpoint won't be readable by our system and your API will break.The
start
node only has a name and a next property, to choose how your API endpoint should start you would change thestart
node'snext property
to the trigger you want to start your endpoint from. read more about triggers
Edit a node
You will notice that every node has a settings icon, if you click on it the configurations editor will open so you can edit your node and then click on Done to save your changes.
Triggers
A trigger is what a node should do after it finish running... this can be another node, stop
, or another endpoint in your API.
There is a number of triggers:
Next: The next trigger exists in all nodes, It defines what the node should call after it's done running. if an error happens in the node It will stop and return the error (won't call the next trigger). exceptions:
- Boolean Conditions: in boolean conditions nodes, the next trigger will be called only if the condition expression results is
true
. otherwise It will call the false trigger.
- Boolean Conditions: in boolean conditions nodes, the next trigger will be called only if the condition expression results is
False trigger: false triggers only exist in the boolean conditions nodes and they are triggered if the expression result is
false
, otherwise It will trigger the next trigger as any other node.Loop trigger: loop triggers only exist in loop nodes and they define that event (node or endpoint) that the loop should call while mapping over the set of items.
If you set the trigger of a node as another endpoint, the other endpoint will be executed in the same environment and It will share all the previous nodes responses that are saved as a response. see Nodes responses below.
Nodes responses
When a node finish running, It will save its result as a response that can be accessed from other nodes with the following syntax koxy.res.{NODE_NAME}
and you can read nested values using dot notation like this: koxy.res.{NODE_NAME.item1}
.
However, not all nodes support this feature like:
Boolean conditions.
Logs.
Delay.
Loops.
Status.
Create variable.
Delete a node
You can delete a node from the navigator
in the bottom-right corner (the map icon).