How to have CURL command equivalent of triple quotes?

hi,
we have a watcher code which contains

  "actions": {
    "index_alert": {
        "transform": {
            "script": {
            "source": """
                return [
                'watch_id': ctx.watch_id,
                '@timestamp': ctx.execution_time,
                'scheduled_time': ctx.trigger.scheduled_time
                ]
              """,
            "lang": "painless"
            }

which works correctly if we do via Kibana DEV console.

But if the same code is part of CURL payload, it fails with below error due to Triple quotes

{"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"[56:23] [script] failed to parse object"}],"type":"x_content_parse_exception","reason":"[56:23] [script] failed to parse object","caused_by":{"type":"json_parse_exception","reason":"Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n a

How to ensure both CURL and Kibana DEV tools work with such scenarios?

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.