<@ULVA73B9P> I was reading through these docs here...
# ask-marvin
m
@Marvin I was reading through these docs here, https://docs.prefect.io/latest/api-ref/rest-api/#curl-with-prefect-cloud, to create a flow run using curl for experimentation. Here is the example given below.
Copy code
ACCOUNT_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?
m
It seems the search results I found don't directly cover how to pass parameters to the
create_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:
Copy code
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.
❤️ 1