首页 > 解决方案 > 如何在Apache气流中通过rest api触发dag,得到403禁止错误

问题描述

我尝试使用以下命令

curl -X POST  
http://localhost:8080/api/experimental/dags/dag_trigger_external_api/dag_runs
H 'Cache-Control: no-cache' -H 'Content-Type: application/json' -d '{"conf":"{\"key\":\"value\"}"}'

我还在airflow_home目录下的pulgin文件夹中安装了REST_api插件并设置了rbac=True

我还在airflow.config文件中插入了以下代码行

过滤掉来自标准输出的加载消息 默认值:真

filter_loading_messages_in_cli_response = True

用于验证 REST API 插件的 REST 调用的 HTTP 标头名称 默认:“rest_api_plugin_http_token”

rest_api_plugin_http_token_header_name = rest_api_plugin_http_token

用于对 REST API 插件的 REST 调用进行身份验证的 HTTP 令牌 默认值:无 将此注释掉以禁用身份验证

rest_api_plugin_expected_http_token = 无

标签: pythonrestairflow

解决方案


推荐阅读