Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a DAG using the REST API

Tags:

python

airflow

Is it possible to create, by sending the DAG file contents, to Apache Airflow using the API?

For example, it is possible to list all DAGs using the API

curl -u "admin:admin" http://localhost:8080/api/v1/dags         
{
  "dags": [],
  "total_entries": 0
}
like image 682
Rodrigo Avatar asked Oct 17 '25 19:10

Rodrigo


1 Answers

You can not create new DAGs via API. You can read a discussion about this request in the project https://github.com/apache/airflow/discussions/24744 which also lists the reasons why Airflow won't have it.

In simple words by adding such API it means that the machine(s) where DAGs are deployed to need to have credentials to write those DAG files to all the other components.

For such use case you better to use Git sync to add files to the DAG directory.

like image 136
Elad Kalif Avatar answered Oct 19 '25 08:10

Elad Kalif