Hello everyone, How can I get the task-runs of a f...
# prefect-community
t
Hello everyone, How can I get the task-runs of a flow-run via REST API. I tried
tr = await client.read_task_runs(limit=1, flow_run_filter=FlowRunFilter.construct(id="562d1705cfcc48a0b55df98373fd10bd"))
But it fails with:
Copy code
HTTPStatusError: Client error '422 Unprocessable Entity' for url '<https://api.prefect.cloud/api/accounts/******-****-***-****-***********/workspaces/*******-****-****-****-********/task_runs/filter>'
For more information check: <https://httpstatuses.com/422>
m
Hey @Tim-Oliver I think this is an error from the flow_run_filter, could you try constructing the filter this way
filter = FlowRunFilter(id=FlowRunFilterId(any_=[flow_run_id]))
This discourse article has a full example https://discourse.prefect.io/t/how-to-use-filters-in-the-prefect-2-api/1522