Hi folks, quick API question — in this query I can...
# prefect-community
j
Hi folks, quick API question — in this query I can grab a particular parameter (awesome) but would love to be able to filter on a particular value, e.g. “company_slug=acmecorp” — is this possible today? Thanks 🙏
Copy code
query {
  flow_run {
    name
    parameters(path: "company_slug")
  }
}
k
Hey Jeff! You can definitely filter your query to a particular value, it would probably look something like this:
Copy code
query {
  flow_run(where: {parameters: {_contains: "table"}}) {
    id
    name
  }
}
upvote 1
j
Thanks Kyle! I think I am close… I can create a query like that (substituting “table” for a value I know exists) and the query is syntactically correct but does not bring back any flow runs (even though I know some exist). I might not be understanding what “_contains” actually does — the help is almost helpful but I can’t actually see what is says… anyway I’ll keep digging, thanks again.
k
j
ah, got it, yes thank you!
Just to close the loop, here’s the final query:
Copy code
query {
          flow_run(where: {
            _and: {
                flow: {
                    name: { _eq: "jf_data_pipeline" }
                    version_group_id: { _eq: "staging"},
                    archived: { _eq: false }     
                  }
                state: { _eq: "Running" },
                parameters: { _contains: { company_slug: "acmecorp" } },
            }
          }) {
            flow_id
            state
          }
        }
Loving the GraphQL API!
👍 1
k
Nice!