we are trying to get the specific field from the secret via a vault API call.
curl -v -k --header "X-Vault-Token: " --request GET https:///v1/<secretengine_name>/?field=
The above API call is not working. It’s working with CLI.
Thanks,
Niranjan
we are trying to get the specific field from the secret via a vault API call.
curl -v -k --header "X-Vault-Token: " --request GET https:///v1/<secretengine_name>/?field=
The above API call is not working. It’s working with CLI.
Thanks,
Niranjan
Is this the k/v secret engine and if so, is it the versioned on?
If this is the case there should be an additional data
between secret-engine
and your-key
.
Even with K/V2 how to retrieve the specific key from the secret. If the secret has multiple key/vaule pairs.
+1
how to get value of specific key on kv/kv2 engine using curl?
Hi @AndroiDjo,
you can try the -output-as-curl cli flag, e. g.
vault kv get -output-curl-string secret/mysecret
.
However, according to [1], “field” is a cli feature. The api always returns a full response.
I like to use jq [2] to parse and extract data from the response. It is used like this (same with curl):
vault kv get -format=json secret/mysecret | jq -r .data.data.excited
Best
Nick
[1] -field option for HTTP API? · Issue #2421 · hashicorp/vault · GitHub
[2] GitHub - stedolan/jq: Command-line JSON processor