How to acces kv by using HTTP API?

Hi,

Now, in my consul client, I can get the kv in my server with ACL token:
consul kv get -token='test' micro/config/mysql

so how to get the kv by using HTTP API?
I’ve found these:

$ curl \    --header "X-Consul-Token: <consul token>" \    http://127.0.0.1:8501/v1/micro/config/mysql

Is this the right request?

Thanks
Yuxuan

Hi @cheyuxuanll,

The KV store API can be accessed under the /v1/kv API endpoint.

The following command will attempt to retrieve the specified key from Consul.

$ curl --header "X-Consul-Token: <consul token>" \
    https://127.0.0.1:8501/v1/kv/micro/config/mysql
1 Like