So I am trying to build my first Flow and need some help. I’m trying to call an API based on the response from another API.
Here’s the process:
Call 1st API
Read response and if the status say success, call the 2nd API.
The only way I can get it to work is to insert a delay after calling the 1st API. It works, but not ideal because the response may at times take longer than my delay I have set…
Here is what I have so far:
<script is="dmx-flow" id="flow2" type="text/dmx-flow">[
{
run: {action: "{{api1.load()}}"}
},
{
wait: {delay: 5000}
},
{
condition: {
if: "{{api1.data.status.contains(\"success\")}}",
then: {
steps: {
run: {action: "{{api2.load()}}"}
}
},
else: {
steps: {
bootbox.alert: {message: "failure"}
}
}
}
}
]</script>
How can I make the second call trigger conditionally on the first call, or am I going about this the wrong way?
Thanks,
Chris
Community Page
Last updated:
Last updated: