Health for list-checks-for-service

Hi Team,

I am using consul 1.12.2.

GET /v1/health/checks/{service-name}.

The above REST API responds with an empty array . Whereas, the expected output is as follows:
[{“Node”:“edgex-core-consul”,“CheckID”:“core-metadata”,“Name”:“Health Check: core-metadata”,“Status”:“passing”,“Notes”:“Check the health of the API”,“Output”:“HTTP GET http://edgex-core-metadata:59881/api/v2/ping: 200 OK Output: {"apiVersion":"v2","timestamp":"Fri Aug 4 15:21:43 UTC 2023"}”,“ServiceID”:“core-metadata”,“ServiceName”:“core-metadata”,“ServiceTags”:,“Type”:“http”,“Interval”:“10s”,“Timeout”:“0s”,“ExposedPort”:0,“Definition”:{},“CreateIndex”:9034,“ModifyIndex”:9046}]

Could you please help me the below:

  • To verify, what is going wrong in my setup?
  • What changes I need to make in order to register that API and it should give a valid response.

Hi @AbhishekS2304,

Are ACLs enabled in your cluster? If so, you will need to pass a Consul token in your HTTP request in order to authenticate with the cluster and retrieve the service information. See for info on how to do this.

The token you provide needs to have permission to read the service name you are querying, otherwise the API will return an empty array.