About JSON API Keys

The JSON plugin allows writes from remote computers provided they include a header with a valid API key. Here we describe how a server administrator can manage keys.

Valid keys are kept in a tokens.json file, one file for each site hosted by the server. If server data is kept in the customary ~/.wiki directory, look to these locations.

~/.wiki/status/plugin/json/tokens.json ~/.wiki/<site>/status/plugin/json/tokens.json

The tokens are listed by slug, where * means all slugs.

tokens = {slug: keys} keys = {key: info} info = {id: string, nb: string}

A complete tokens.json file might look like this.

{ "json-plugin": { "429c7b": { "id": "demo", "nb": "widely known, discard if abused" } }, "*": { "79ce4a": { "id": "wildcard", "nb": "ward, experimental use only" } } }

The info fields are for the convenience of administrators. The id might be returned to requesters in some situations while the nb field will remain private.

Longer keys are encouraged.