mvryan
mvryan

Reputation: 347

Filtering returned consul.io services on tag

I was wondering if there is a way to filter the services consul returns me using tags.

The endpoint:

/v1/catalog/services

returns a map of services to lists of tags and requires me to parse the services after they are returned.

I was wondering if there is some way to pass the tag (or tags) I want as a query parameter to the endpoint and get a map back that is already filtered.

Upvotes: 6

Views: 3061

Answers (2)

Dwight Spencer
Dwight Spencer

Reputation: 1596

its supported by the ?tags=... query parameter to the individual service: https://www.consul.io/docs/agent/http/catalog.html#catalog_service

Otherwise one could just parse the returned json from catalog/services.

Upvotes: -1

superfell
superfell

Reputation: 19040

Based on the docs and my own experiments this doesn't appear to be supported, agree that it would be useful.

Upvotes: 2

Related Questions