Emergency Hamburg Wiki

API Reference

A worked example of the REST API, and where the real documentation lives.

API Reference

The whole API is browsable at /_api in a running instance, generated from the route schemas
themselves — so it is never out of date with the server answering it.

Authenticating

Session cookie for a browser, bearer token for everything else.

curl -H "Authorization: Bearer $WIKI_API_KEY" https://wiki.example.com/_api/sites

Creating a page

create-page.mjs
const res = await fetch(`/_api/sites/${'$'}{siteId}/pages`, {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({
    path: 'notes/first',
    title: 'My first page',
    editor: 'markdown',
    content: '# Hello',
    render: '<h1>Hello</h1>',
    tags: ['test']
  })
})

Note

content is the source and render is the HTML produced from it. The server sanitizes the render
against what the author is allowed to embed, so read the response rather than assuming what was
sent is what was stored.

See also