# Webhook URL issue, always appending the query ? even without parameters

**URL:** https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577
**Category:** Kibana
**Created:** [March 5, 2018, 7:06pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577 "2018-03-05T19:06:57Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![sgrady](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@sgrady](https://discuss.elastic.co/u/sgrady)
#### Post date: [March 5, 2018, 7:06pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/1 "2018-03-05T19:06:58Z")

</div>

We setup an ElasticSearch watcher through the Kibana - ElasticSearch - Watcher - Watches.

I added the JSON and our 'params' section is empty, but the generated URL always has a '?' appended even if we don't want any query parameters. If I try to remove the 'params' section completely it gets put back in automatically. Has anyone encountered this issue? I feel like I'm overlooking something very simple but cannot find anything in the documentation.

"webhook": {  
"scheme": "https",  
"host": "[server.com](http://server.com)",  
"port": 443,  
"method": "post",  
"path": "/testpath",  
"params": {},  
"headers": {  
"Content-type": "application/json"  
},  
"body": "{"message\_type": "CRITICAL","monitoring\_tool": "Elastic Watcher","entity\_id": "{{ctx.id}}","entity\_display\_name": "{{ctx.watch\_id}}","state\_message": "{{ctx.watch\_id}}","elastic\_watcher\_payload": {{#toJson}}ctx.payload{{/toJson}} }"  
}

---

<div class="post-metadata">

### Author: ![chrisronline](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrisronline/32/28230_2.png) [@chrisronline](https://discuss.elastic.co/u/chrisronline)
#### Post date: [March 5, 2018, 9:52pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/2 "2018-03-05T21:52:29Z")

</div>

Hi @sgrady,

What if you simply omit the `params` property, as in the [examples here](https://www.elastic.co/guide/en/x-pack/current/actions-webhook.html)?

---

<div class="post-metadata">

### Author: ![sgrady](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@sgrady](https://discuss.elastic.co/u/sgrady)
#### Post date: [March 5, 2018, 10:11pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/3 "2018-03-05T22:11:51Z")

</div>

Hi Chris, thanks for taking the time to respond. I did in fact try that and  
found very odd behavior.

I went into the editor in the Kibana UI and deleted that line, then I click  
'Save'. If I then go back into the editor and look, that empty params block  
has appeared again.

I also tried deleting it completely and adding in the JSON with the params  
section removed - it pastes in at 38 total lines, and if I go back into the  
editor again to verify the code, it is 39 lines long and the empty params  
block has been inserted. I don't understand what is going on.

Is there something else that needs to be changed?

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [March 5, 2018, 11:11pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/4 "2018-03-05T23:11:38Z")

</div>

would you mind sharing the whole watch by using the get watch API in the console? And also share the output of the execute watch API?

Also, which version is this on?

---

<div class="post-metadata">

### Author: ![sgrady](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@sgrady](https://discuss.elastic.co/u/sgrady)
#### Post date: [March 5, 2018, 11:33pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/5 "2018-03-05T23:33:12Z")

</div>

I had trouble finding a definitive version on the website, I think it is  
v6.0.2. This is in an account I created just last week.

From the GET call, I get the following JSON that still shows an empty  
'params' section.

```
{
  "found": true,
  "_id": "TEST2",
  "status": {
    "state": {
      "active": true,
      "timestamp": "2018-03-05T22:42:25.035Z"
    },
    "last_checked": "2018-03-05T23:32:03.750Z",
    "last_met_condition": "2018-03-05T23:32:03.750Z",
    "actions": {
      "victorops": {
        "ack": {
          "timestamp": "2018-03-05T22:42:25.035Z",
          "state": "awaits_successful_execution"
        },
        "last_execution": {
          "timestamp": "2018-03-05T23:32:03.750Z",
          "successful": false,
          "reason": "received [404] status code"
        }
      }
    },
    "execution_state": "executed",
    "version": 85
  },
  "watch": {
    "trigger": {
      "schedule": {
        "interval": "60s"
      }
    },
    "input": {
      "http": {
        "request": {
          "scheme": "http",
          "host": "
elastic:COO7Ch7qrAXnPVIwov08iWuI@2f867613f1cea4d95b58e5bdc5d49899.us-west-2.aws.found.io
",
          "port": 9200,
          "method": "get",
          "path": "/_cluster/health",
          "params": {},
          "headers": {}
        }
      }
    },
    "condition": {
      "always": {}
    },
    "actions": {
      "victorops": {
        "webhook": {
          "scheme": "https",
          "host": "stalert-victorops-com-1mnhtnnwmozq.runscope.net",
          "port": 443,
          "method": "post",
          "path":
"/integrations/generic/20131114/alert/83d27235-9641-4e78-bcc0-bfd572625621/testroutekey",
          "params": {},
          "headers": {
            "Content-type": "application/json"
          },
          "body": """{"message_type": "CRITICAL","monitoring_tool":
"Elastic Watcher","entity_id": "{{ctx.id}}","entity_display_name":
"{{ctx.watch_id}}","state_message":
"{{ctx.watch_id}}","elastic_watcher_payload":
{{#toJson}}ctx.payload{{/toJson}} }"""
        }
      }
    },
    "metadata": {
      "name": "Test 2",
      "xpack": {
        "type": "json"
      }
    }
  }
}
```

---

<div class="post-metadata">

### Author: ![sgrady](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@sgrady](https://discuss.elastic.co/u/sgrady)
#### Post date: [March 6, 2018, 2:47pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/6 "2018-03-06T14:47:02Z")

</div>

I also attempted to use the PUT endpoint to add a new watcher. In the new  
JSON I don't have the 'params' section at all. The PUT command comes back  
as success, and I got back and look at the code it uploaded and the  
'params' section has been inserted.

I don't understand why the '?' is appended to the URL or how to get rid of  
it at this point.

---

<div class="post-metadata">

### Author: ![sgrady](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@sgrady](https://discuss.elastic.co/u/sgrady)
#### Post date: [March 7, 2018, 6:01pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/7 "2018-03-07T18:01:48Z")

</div>

Are there any other working webhook examples available?

I'm not finding a way around this params/'?' issue.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [March 15, 2018, 9:06pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/8 "2018-03-15T21:06:07Z")

</div>

can you share the exact JSON you used to put the watch? also which elasticsearch version is this you are running this against?

Thank you!

---

<div class="post-metadata">

### Author: ![dmdm](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@dmdm](https://discuss.elastic.co/u/dmdm)
#### Post date: [March 22, 2018, 5:50pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/9 "2018-03-22T17:50:57Z")

</div>

I have the same issue here is a watcher with service api and routing key removed:

```auto
{
  "trigger": {
    "schedule": {
      "interval": "60s"
    }
  },
  "input": {
    "http": {
      "request": {
        "scheme": "http",
        "host": "localhost",
        "port": 9200,
        "method": "get",
        "path": "/_cluster/health",
        "params": {},
        "headers": {}
      }
    }
  },
  "condition": {
    "always": {}
  },
  "actions": {
    "victorops": {
      "webhook": {
        "scheme": "https",
        "host": "alert.victorops.com",
        "port": 443,
        "method": "post",
        "path": "/integrations/generic/20131114/alert/serviceapi/routingkey",
        "params": {},
        "headers": {
          "Content-type": "application/json"
        },
        "body": "{\"message_type\": \"CRITICAL\",\"monitoring_tool\": \"Elastic Watcher\",\"entity_id\": \"{{ctx.id}}\",\"entity_display_name\": \"{{ctx.watch_id}}\",\"state_message\": \"{{ctx.watch_id}}\",\"elastic_watcher_payload\": {{#toJson}}ctx.payload{{/toJson}} }"
      }
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![chall](https://avatars.discourse-cdn.com/v4/letter/c/b9e5f3/32.png) [@chall](https://discuss.elastic.co/u/chall)
#### Post date: [March 22, 2018, 5:53pm UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/10 "2018-03-22T17:53:50Z")

</div>

I am having a similar issue which Sean described above. I didn't use a PUT to create the watch, instead I built the entire watch using Kibana. I however seemed to have narrowed the issue to some sort of haproxy issue.

The alert seems to be directed to the entirely wrong url for some reason, thus yielding a 404 error. I should also note that when replicating the configuration as a curl it works just fine when posting to a victorops endpoint.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [March 23, 2018, 12:11am UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/11 "2018-03-23T00:11:44Z")

</div>

I found the issue regarding the question mark at the end of the path, even though there are no parameters. It's a bug. I'll fix it.

---

<div class="post-metadata">

### Author: ![sgrady](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@sgrady](https://discuss.elastic.co/u/sgrady)
#### Post date: [March 23, 2018, 12:47am UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/12 "2018-03-23T00:47:10Z")

</div>

Great, thanks for checking that out.

There still seems to be some issue at play here from some further testing I performed. It looks on my side like the url is still getting routed incorrectly - almost like the host and is getting chopped off or something. We should be hitting “[alert.server.com](http://alert.server.com)” for example to get routed correctly, and I can run a curl that works, but the one from kibana shows a 404 in the UI.

Is there anything else that happens to the url info before posting to the webhook? Is it possible to see logs of exactly what kibana was trying to hit?

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [March 23, 2018, 12:48am UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/13 "2018-03-23T00:48:14Z")

</div>

you can use the [execute watch API](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/watcher-api-execute-watch.html) and paste the output (in a formatted way, please), and I'm happy to take a look!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 20, 2018, 12:48am UTC](https://discuss.elastic.co/t/webhook-url-issue-always-appending-the-query-even-without-parameters/122577/14 "2018-04-20T00:48:20Z")

</div>

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