我尝试使用Curl命令将多个变量导入到Airflow UI。当我尝试使用有效负载导入多个变量时出现问题。
我尝试使用Curl命令将多个变量导入气流UI。对于单个变量,以下命令工作正常。curl -X 'POST' 'http://10.135.7.13:9081/api/v1/variables' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{"key": "string","value": "string"}' --user 'usr:pwd'
但对于多变量,尝试了所有可能的方法,并得到不同的错误。
**1.**一米一米一
{
"detail": "{'value': ['Missing data for required field.'], 'key': ['Missing data for required field.'], 'key2': ['Unknown field.'], 'key1': ['Unknown field.']}",
"status": 400,
"title": "Invalid Variable schema",
"type": "https://airflow.apache.org/docs/apache-airflow/2.2.2/stable-rest-api-ref.html#section/Errors/BadRequest"
**2.**一米二米一
{
"detail": "{'value': ['Missing data for required field.'], 'key': ['Missing data for required field.'], 'variables': ['Unknown field.']}",
"status": 400,
"title": "Invalid Variable schema",
"type": "https://airflow.apache.org/docs/apache-airflow/2.2.2/stable-rest-api-ref.html#section/Errors/BadRequest"
**3.**一米三米一
"detail": "[{'key': 'string', 'value': 'string'}, {'key': 'string1', 'value': 'string1'}] is not of type 'object'",
"status": 400,
"title": "Bad Request",
"type": "https://airflow.apache.org/docs/apache-airflow/2.2.2/stable-rest-api-ref.html#section/Errors/BadRequest"
}
有谁能帮我理解一下这里的有效载荷应该是什么结构。
1条答案
按热度按时间vnzz0bqm1#
根据文档和代码,一次导入一个变量是唯一可行的方法。
解决方法可以是在数组上执行for循环: