Paymahn Moghadasian created AIRFLOW-4043:
--------------------------------------------

             Summary: 405 when using REST api to get status of a DAG
                 Key: AIRFLOW-4043
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-4043
             Project: Apache Airflow
          Issue Type: Bug
          Components: api
    Affects Versions: 1.10.2
         Environment: I'm running airflow in kubernetes on ubuntu 16.04
            Reporter: Paymahn Moghadasian


I'm trying to use the airflow REST api (v1.10.2) but I'm having problems any 
time I try to query information about a specific dag.

Here's an example of the latest_runs endpoint working:


{noformat}
 ❯❯❯ curl -X GET http://192.168.99.100:30080/api/experimental/latest_runs
{
  "items": [
    {
      "dag_id": "test_dag",
      "dag_run_url": 
"/admin/airflow/graph?dag_id=test_dag&execution_date=2019-03-07+21%3A18%3A23.387031%2B00%3A00",
      "execution_date": "2019-03-07T21:18:23.387031+00:00",
      "start_date": "2019-03-07T21:18:23.683240+00:00"
    }
  ]
}
{noformat}

However, when I try to query test_dag I get an error:


{noformat}
 ❯❯❯ curl -X GET 
"http://192.168.99.100:30080/api/experimental/dags/test_dag/dag_runs";
<!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>
{noformat}

I've also tried looking in the source code and I found that there's a [state 
param|https://github.com/apache/airflow/blob/f4277cb32a3b75591ed6decb9f8d6c33f60986be/airflow/www/api/experimental/endpoints.py#L117]
 that can be used:


{noformat}
 ❯❯❯ curl -X GET 
"http://192.168.99.100:30080/api/experimental/dags/test_dag/dag_runs?state=success";
<!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>
{noformat}

but adding that in doesn't seem to help.

I find that triggering a DAG works:


{noformat}
 ❮❮❮ curl -X POST \
  http://192.168.99.100:30080/api/experimental/dags/test_dag/dag_runs \
  -H 'Content-Type: application/json' \
  -d '{}'
{
  "message": "Created <DagRun test_dag @ 2019-03-07 22:31:18+00:00: 
manual__2019-03-07T22:31:18+00:00, externally triggered: True>"
}
{noformat}

Anyone have an idea why I can't query the status of a DAG and get a 405?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to