How to get all service ip:port via Consul API?

Hey, all

In Product Env, I run curl http://$IP_CONSUL:8500/v1/agent/services to get all services info, but i got the result was not all services ip:port.

Hi @Fabriceli,

Welcome to the HashiCorp Forums!

The /v1/agent/services endpoint only lists services registered to the specific Consul agent you are querying. To get the list of all services in the cluster, you should use the /v1/catalog/services endpoint.

ref: Catalog - HTTP API | Consul | HashiCorp Developer

And you should use the /v1/catalog/service/<service-name> endpoint to get the details about a specific service and its instances.
ref: Catalog - HTTP API | Consul | HashiCorp Developer

I hope this helps.