From a1e5330f78a99e0ddd7cd8b68bf9f494a23ca29f Mon Sep 17 00:00:00 2001 From: boncheff Date: Thu, 28 May 2015 22:28:25 +0100 Subject: [PATCH] Update index.html.md Updated the docs to show an example of how to read/write a secret using the HTTP API --- website/source/docs/http/index.html.md | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/website/source/docs/http/index.html.md b/website/source/docs/http/index.html.md index 6ac68e85e..16652a3de 100644 --- a/website/source/docs/http/index.html.md +++ b/website/source/docs/http/index.html.md @@ -51,6 +51,40 @@ will be sent down with a `Set-Cookie` header as well as via JSON. If you have a well-behaved HTTP client, then authentication information will automatically be saved and sent to the Vault API. +## Reading and writing secrets + +Reading a secret is done by issuing a GET using the following URL: + +`/v1/secret/foo` + +This maps to `secret/foo` where `foo` is the key in the `secret/` backend + +Here is an example of reading a secret using cURL: + +`curl -H "X-Vault-Token: f3b09679-3001-009d-2b80-9c306ab81aa6" -X GET http://127.0.0.1:8200/v1/secret/foo` + +In order to write a secret to `secret/foo` for instance, issue a POST on the following URL: + +`/v1/secret/foo` + +with the following JSON body: + +```javascript +{ + "value": "bar" +} +``` + +Here is an example of writing a secret using cURL: + +`curl -H "X-Vault-Token: f3b09679-3001-009d-2b80-9c306ab81aa6" -H "Content-Type: application/json" -X POST -d '{"value":"bar"}' http://127.0.0.1:8200/v1/secret/baz` + +Also ensure that `X-Vault-Token` is present in the request header + + + + + ## Help To retrieve the help for any API within Vault, including mounted