通过 curl 向 elastic watcher 发送请求

Send request to elastic watcher via curl

麋鹿7.X

我正在尝试使用输入文件通过 curl 创建弹性搜索观察器。像这样

curl -X PUT _watcher/watch/cluster_health_watch --data-binary @inputFile

1) 要使用的文件类型是什么?大部分数据是json,但在发送邮件时在"actions"字段中,邮件正文可以是HTML!

2) 有什么方法可以从外部文件引用正文中的 HTML,这样输入文件可以是 json ?

刚刚通过添加“\”转义了 html 字符串中的双引号。

例如:-

<h3 style=\"color:red\"></h3>
"actions": {
    "send_email": {
      "email": {
        "to": "xxxx@gmail.com",
        "subject": "My Subject",
        "body": {
          "html": "<h3 style=\"color:red\"> There was a problem</h3>"
        }
      }
    }
  }
curl -X PUT _watcher/watch/cluster_health_watch -H 'Content-Type: application/json' --data-binary @inputFile.json