How to use fetch or axios in Flow #17773
Replies: 5 comments 3 replies
-
You can use the "trigger flow" operation to loop through an array. Have you tried this? |
Beta Was this translation helpful? Give feedback.
-
it says https://docs.directus.io/configuration/flows/operations.html
I guess it's not possible |
Beta Was this translation helpful? Give feedback.
-
! Since v.10.6.0 this does not work with
|
Beta Was this translation helpful? Give feedback.
-
Be very careful with making requests like that though. It circumvents security features like |
Beta Was this translation helpful? Give feedback.
-
The work around with trigger another flow for "loops" is not really intuitive and I would wish for a different implementation. |
Beta Was this translation helpful? Give feedback.
-
Hi!
I have a Next.JS project with an API route that is triggered every day by a flow with a Post Req. Unfortunately this takes too long to be used in Vercel.
Now I wanted to do it in such a way that I split this route into pages. That has worked so far.
Now I come to my problem:
But now this flow has to send post requests with a body to this API in a for-loop. The only way to do this would be in a run script opteration since I can't otherwise send web requests in a loop. (Feel free to correct me if I do) I've tried using the Fetch API first, but it always fails. Then I allowed "axios" via the "FLOWS_EXEC_ALLOWED_MODULES" variable. Then I tried the script with axios, unfortunately that didn't work either.
Unfortunately I don't know what else I can try. I am writing the script below. I hope someone can help me here.
script:
Beta Was this translation helpful? Give feedback.
All reactions