Good Afternoon,
I am trying to run a deployment via the REST API but I repeatably get the following error:Flow run failed. Error: POST body missing. Did you forget use body-parser middleware?
This is my code:
import requests
base_url = "https://api.prefect.cloud/api/accounts/myaccountid/workspaces/myworkspaceid
token = "mytoken"
deployment_id = "mydeploymentid"
def create_flow_run(deployment_id, base_url, token):
url = f"{base_url}/deployments/{deployment_id}/create_flow_run"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}",
}
data = {} # Add your request body here
response = requests.post(url, headers=headers, json=data)
return response
r = create_flow_run(deployment_id, base_url, token)
print(r.status_code)
print(r.text)
Any help would be greatly appreciated!