{{define "title"}}{{.Store.Name}} · pocketkv{{end}} {{define "content"}}
Stores /
{{.Error}}
{{end}}| Key | Value | Size | |
|---|---|---|---|
{{.Key}} |
{{.Preview}} |
{{.Size}} B |
No values yet.
{{end}}| Label | Key | Created | |
|---|---|---|---|
| {{if .Label}}{{.Label}}{{else}}—{{end}} | {{.Key}} |
{{.CreatedAt.Format "2006-01-02"}} |
const headers = { Authorization: "Bearer {{.Key}}" };
// one value
const value = await fetch("{{$.BaseURL}}/api/v1/values/{{$.SampleKey}}", { headers }).then(r => r.json());
// every value in the store, as { key: value }
const all = await fetch("{{$.BaseURL}}/api/v1/values", { headers }).then(r => r.json());
<pre id="value">loading…</pre>
<script type="module">
const res = await fetch("{{$.BaseURL}}/api/v1/values/{{$.SampleKey}}", {
headers: { Authorization: "Bearer {{.Key}}" },
});
const value = await res.json();
document.getElementById("value").textContent = JSON.stringify(value, null, 2);
</script>
# one value
curl -H "Authorization: Bearer {{.Key}}" \
{{$.BaseURL}}/api/v1/values/{{$.SampleKey}}
# every value in the store
curl -H "Authorization: Bearer {{.Key}}" \
{{$.BaseURL}}/api/v1/values
import json
import urllib.request
req = urllib.request.Request(
"{{$.BaseURL}}/api/v1/values/{{$.SampleKey}}",
headers={"Authorization": "Bearer {{.Key}}"},
)
with urllib.request.urlopen(req) as res:
value = json.load(res)
req, _ := http.NewRequest("GET", "{{$.BaseURL}}/api/v1/values/{{$.SampleKey}}", nil)
req.Header.Set("Authorization", "Bearer {{.Key}}")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
var value any
if err := json.NewDecoder(res.Body).Decode(&value); err != nil {
log.Fatal(err)
}
Full reference: openapi.yaml
{{end}} {{else}}No API keys yet. Create one to read this store from your sites.
{{end}}