https://prefect.io logo
#prefect-community
Title
# prefect-community
a

Aleksander

08/24/2022, 3:19 PM
Hi! I am trying to trigger a flow run via API call. This guide proved to be very helpful, https://discourse.prefect.io/t/how-to-trigger-a-flow-run-from-a-deployment-via-api-call-using-python-requests-library-or-from-a-terminal-using-curl/1396. I wonder, is it possible to attach data (list or dict) to API request and make that data accessible for triggered flow-run?
1
r

Ryan Peden

08/24/2022, 3:35 PM
If your flow function takes parameters, you can set them in the flow run creation API call using the parameters JSON property: https://docs.prefect.io/api-ref/rest-api/#/Flow%20Runs/create_flow_run_flow_runs__post
a

Aleksander

08/24/2022, 3:37 PM
Thanks for response! I was trying to do that, but I am getting
TypeError: unhashable type: 'list
I have a list as a parameter
No worries, I just had an syntax error. Here is example that seems to work
json={"name": "flow_name", "state": {"type": "SCHEDULED"}, "parameters": {"myList": myList},}
. Thanks Ryan!
r

Ryan Peden

08/24/2022, 3:45 PM
Thanks for the update - I was just about to ask what your parameters JSON looked like 🙂
And you are welcome!
3 Views