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

Hello,

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": {
                "path":"http://localhost:1234/watch",
                "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

[{"Key":"testwatch/","CreateIndex":2693905,"ModifyIndex":2693905,"LockIndex":0,"Flags":0,"Value":null,"Session":""},{"Key":"testwatch/mykey1","CreateIndex":2693921,"ModifyIndex":2694020,"LockIndex":0,"Flags":0,"Value":"dmFsdWUx","Session":""}]

Hope this helps.