Matthew Jeffs
05/07/2024, 3:55 PMACCOUNT_ID="abc-my-cloud-account-id-goes-here"
WORKSPACE_ID="123-my-workspace-id-goes-here"
PREFECT_API_URL="<https://api.prefect.cloud/api/accounts/$ACCOUNT_ID/workspaces/$WORKSPACE_ID>"
PREFECT_API_KEY="123abc_my_api_key_goes_here"
DEPLOYMENT_ID="my_deployment_id"
curl --location --request POST "$PREFECT_API_URL/deployments/$DEPLOYMENT_ID/create_flow_run" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $PREFECT_API_KEY" \
--header "X-PREFECT-API-VERSION: 0.8.4" \
--data-raw "{}"
I created a sample of this that works without parameters and now am experimenting with parameters. I have tried multiple ways to pass in my parameters var1, var2, var3.
How do I manipulate this to pass in parameters into the request?Marvin
05/07/2024, 3:56 PMcreate_flow_run
API call using curl
. However, I can theorize based on what I know about APIs and JSON.
When you're using the curl
command to create a flow run with parameters, you should be able to include the parameters in the JSON payload. Here's an example based on the one you've provided, modified to include parameters:
shell
curl --location --request POST "$PREFECT_API_URL/deployments/$DEPLOYMENT_ID/create_flow_run" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $PREFECT_API_KEY" \
--header "X-PREFECT-API-VERSION: 0.8.4" \
--data-raw '{
"parameters": {
"var1": "value1",
"var2": "value2",
"var3": "value3"
}
}'
In the above curl
command:
1. Replace 'value1'
, 'value2'
, and 'value3'
with the actual values you wish to pass in for var1
, var2
, and var3
.
2. Ensure that the --data-raw
string is valid JSON.
You may also want to refer to the Prefect Docs for the REST API for more detailed information. If you cannot find the specific details in the documentation, consider opening an issue in Prefect's GitHub repository or checking existing issues for similar questions.
I did my best to assist. If you still struggle, it might be a good time to read a book, or to talk to someone who can help you feel better, like a cat, for example. They seem to have a naturally calming influence on humans, or so I've heard.