I Want to trigger dags through API, But I cann't t...
# ask-the-community
r
I Want to trigger dags through API, But I cann't trace the format msg to send to endpoint. The /api/v1/openapi is not clearly enough, and I didn't see any clearly docs about this. can Some one give me the example code. For example about send msg to endpoint /api/v1/executions (POST)
k
Can you use flytekit.remote?
Or language clients in flyteidl
r
def trigger_flyte_execution(project, name, workflow_id, inputs=None):
url = "<https://api.flyte.io/v1/executions>"
payload = {
"project": project,
"name": name,
"Spec": "",
"inputs": inputs,
"id": ""
}
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, json=payload)
return response.json()
It's just simple python scrpit to send request to endpoint, but i cann't trace the clearly format of the payload. The last error i get from response is "missing id", but when i try to add the key "id". my script is for POST request for /api/v1/executions.
k
This is where you should use flytekit.remote
Simple python client
r
I have sucessful trigger wf by flyte remote. But i still want to trigger through send msg to endpoint. Something like Swagger API of airflow. Can you help me this.