https://prefect.io logo
Title
m

Matias Godoy

05/07/2020, 2:55 PM
Hello! I'm using GraphQL to run flows. The problem is that the API requires the flow_id, which changes every time I register a new version of said flow. Is there a way to run a flow by name instead of by id using GraphQL?
a

Alex Cano

05/07/2020, 3:00 PM
If you take a look at the docs (here)[https://docs.prefect.io/orchestration/concepts/flow_runs.html#creating-a-flow-run] under the
GraphQL
section, there’s a note saying you can provide a
version_group_id
for this purpose. If you assign a consistent
version_group_id
value for each version of your flow, specifying the
version_group_id
during the API call will automatically schedule a new flow run of the most recent version of that flow.
:upvote: 1
j

Jeremiah

05/07/2020, 3:01 PM
Beat me to it @Alex Cano - and one extra detail, a
version_group_id
is automatically assigned to your flow if you don’t provide one yourself, and the auto-generated one is based on the flow name, so you can query it and use it even if you haven’t been setting them yourself for each version
🙌 1
m

Matias Godoy

05/07/2020, 3:03 PM
Great! I'll take a look at this. I don't know how I missed it in the docs. Thanks a lot!