我正在尝试使用如下的curl命令运行shell脚本,并以--data-raw作为主体。
curl --location --request POST '<URL>' \
--header 'Content-Type: application/json' \
--data-raw '{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Help Text",
"emoji": true
}
},
{
"type": "divider"
},
]
}'
Run Code Online (Sandbox Code Playgroud)
输出:
curl: option --data-raw: is unknown
curl: try 'curl --help' or 'curl --manual' for more information
Run Code Online (Sandbox Code Playgroud)
我找不到 json 验证器的任何错误。请提出一个解决方案。TIA。
Gil*_*not 13
,需要删除第 14 行--data和定界符:curl --location --request POST '<URL>' \
--header 'Content-Type: application/json' \
--data "@/dev/stdin"<<EOF
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Help Text",
"emoji": true
}
},
{
"type": "divider"
}
]
}
EOF
Run Code Online (Sandbox Code Playgroud)
cat <<EOF后面是几行文本,后面是EOF新行上的文字字符串,不缩进。s之间的部分EOF作为标准输入传递给命令。如果'EOF'是“引用”,则不会进行替换;否则他们就是。请<<-参阅缩进品种(不推荐,需要制表符)。
| 归档时间: |
|
| 查看次数: |
17914 次 |
| 最近记录: |