hey guys would anyone have a simple example of usi...
# ask-community
k
hey guys would anyone have a simple example of using a GQL query to trigger a flow run I can look at?
k
It will be easier to use
Client.create_flow_run
, do you really want to use the GraphQL API?
You can use the native requests library like this:
Copy code
import requests

query = """
 mutation {
  create_flow_run(input: { version_group_id: "fb919cc4-7f74-4ed7-9f3c-71bdd9be69e8" }) {
    id
  }
}
"""

url = "<<https://api.prefect.io>>"
response = <http://requests.post|requests.post>(
    url, json={"query": query}, headers={"authorization": "Bearer XXX"}
)
print(response.status_code)
print(response.text)
Also can be seen here but pretty much the same
k
ah cool I was asking primarily out of curiosity. I was imagining making requests direct to prefect via some external application
thanks for the quick response 🙂
👍 1