Configuring http handler_type for keyprefix changes

Hi, Can someone please point how i can use API or command to configure http handler for keyprefix watch


The example HTTP endpoint configuration shown on the Consul Watches documentation works for the keyprefix type, in addition to key (and other types).

Here is an example config for a keyprefix watch using the http handler type.

    "watches": [
            "type": "keyprefix",
            "prefix": "testwatch/",
            "handler_type": "http",
            "http_handler_config": {
                "method": "POST",
                "header": {"x-foo":["bar", "baz"]},
                "timeout": "10s"

After reloading the Consul server configuration, use the Consul client to create a key under the “testwatch/” prefix.

$ consul kv put testwatch/mykey1 value1
Success! Data written to: testwatch/mykey1

A JSON payload containing all of the keys present under the given keyprefix will be POSTed to the HTTP endpoint for any create, update, or delete operation on keys under that prefix.

POST /watch HTTP/1.1
Host: localhost:1234
User-Agent: Go-http-client/1.1
Content-Length: 236
Content-Type: application/json
X-Consul-Index: 2694020
X-Foo: bar
X-Foo: baz
Accept-Encoding: gzip
Connection: close


Hope this helps.