Hi everyone, thanks for this awesome tool and cha...
# prefect-ui
t
Hi everyone, thanks for this awesome tool and channel. I'm wondering if I can trigger a Flow from a external API. Not by using the UI. Somelike using FLASK API for instance. It is possible or there is any documentation available?
k
Hi @TOMAS IGNACIO ACUÑA RUZ! Yes you can use the graphQL API to do this. Click the
Interactive API
tab of the UI for available operations
upvote 1
t
Hi @Kevin Kho thanks for your response. I have seen this information, maybe you can correct me, but I thought this API just interact from the browser and not by a external API over an external server.
k
You can interact with it through the
prefect.client
Client with Python
Something like this:
Copy code
from prefect.client import Client
client = Client()
result = json.loads(client.graphql(query).to_json())
t
ajaa ok!
I'm gona try
So when you want to execute some flow, you add the run parameter?
k
The
create_flow_run
mutation accepts parameters. You can schedule the time for the current time to run immediately.
t
excleente
thanks you very much
Hi @Kevin Kho I'm seen this documentation https://docs.prefect.io/api/latest/cli/run.html
its more easier to me work directly for command line than python, do you know where do I have to define the parameters-string inside my Flow?
k
nice!