Reputation: 59
I'm trying to set up my application to use Airflow's Experimental API. I'm using apache-airflow==1.10.2
.
Using the config straight out of the box (no authentication enabled), I'm able to create DAG runs using the POST /api/experimental/dags/<DAG_ID>/dag_runs
endpoint. However, when I try to use GET /api/experimental/dags/<DAG_ID>/dag_runs
I get 405s.
I tried enabling authentication when I noticed that that GET endpoint is part of the www_rbac
folder, but not part of the www
file. To verify I was able to successfully setup authentication, I configured it for both the api and webserver.
[api]
authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth
and for the webserver:
[webserver]
# additional config omitted for brevity
authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth
I created a user using the airflow cli. Then, I was able to log into the webserver using those credentials. Problem is when I try to use that same credentials authenticating on the API, I'm still getting 405s.
Sample curl I'm using is:
curl -X GET \
http://api_admin:[email protected]/api/experimental/dags/example_bash_operator/dag_runs \
-H 'Cache-Control: no-cache'
(Real curl has actual username, password, and hostname.)
Response body is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The method is not allowed for the requested URL.</p>
Curl for POST request that does work:
curl -X POST \
http://api_admin:[email protected]/api/experimental/dags/example_bash_operator/dag_runs \
-H 'Cache-Control: no-cache' \
-d '{}'
Good news is that when I have authentication enabled and omit the username and password from the request, I get 401 - Unauthorized.
Has anybody been able to use the GET
dag_run endpoint to work?
Upvotes: 3
Views: 1393
Reputation: 18824
That is a bug in 1.10.2
and has been fixed for 1.10.3
which will be released this week.
Till then you can use the rbac UI:
Enable the RBAC UI by modifying airflow.cfg
file.
Under [webserver]
section, change rbac = False
to rbac = True
Note you will have to create a user as per https://airflow.apache.org/security.html?highlight=rbac#password
Upvotes: 1