Referring the below documentation of consul for HTTP API
https://www.consul.io/api/kv.html
recurse (bool: false) - Specifies if the lookup should be recursive and key treated as a prefix instead of a literal match. This is specified as part of the URL as a query parameter.
raw (bool: false) - Specifies the response is just the raw value of the key, without any encoding or metadata. This is specified as part of the URL as a query parameter.
I was expecting decoded values in the response returned for below request http://localhost:8500/v1/kv/?recurse=true&raw=true
The recurse
option is working as I can see all the key/val pairs present in the response JSON but the values are still encoded (base64).
Is the raw
query parameter not working or am I doing something wrong?
Their document is somehow misleading. These parameters will work individually. However when you try to combine them, they don't work as what you think.
Some alternative way to address what you need.
You can do first get a list of keys by
http://localhost:8500/v1/kv/?keys
And then, looping through the key and get the value individually
http://localhost:8500/v1/kv/YourKey?raw
Otherwise, decode the value in your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With