Hi! I am trying to trigger a flow run via API call...
# prefect-community
a
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
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
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
Thanks for the update - I was just about to ask what your parameters JSON looked like 🙂
And you are welcome!