Consul configuration to send api request

Hello! Could be possible configurate Consul to call a rest api every time that a new service is up? or a old is down?

Example: A service called “pipeline” is deployed. So, Consul send a POST request to http://localhost:3000/updateroutes with a list of available services.

I’ve found a solution:

In agent command (to start Consul):
sudo consul agent --dev --client --config-file ./path/consul-agent.json

In consul-agent.json file:
“watches”: [
“type”: “services”,
“handler_type”: “http”,
“http_handler_config”: {
“path”: “https://localhost/routetocall”,
“method”: “POST”,
“header”: { “Authentication”: [“something”] },
“timeout”: “10s”,
“tls_skip_verify”: true