Rodrigo
Rodrigo

Reputation: 411

Create a DAG using the REST API

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
}

Upvotes: 4

Views: 4282

Answers (1)

Elad Kalif
Elad Kalif

Reputation: 16109

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.

Upvotes: 5

Related Questions