Kaiku

← All documentation

Wiki API

The wiki speaks the REST API of the widely used corporate wiki: what it answers, what it stores, and its query language.

What it is

Every project has exactly one wiki space, and the space key is the project key. The wiki answers the REST API of the self-hosted edition of the widely used corporate wiki at https://<workspace>.kaiku.tech/rest/api/…, and the same requests under /wiki/rest/api/… for tools that expect the cloud layout. The token is the same one — see Connecting a tool.

Errors have that wiki’s own shape, which differs from the tracker’s. A page you may not see is a 404; a 403 means you can see it but not change it.

What is answered

AreaRequests
Pagescontent — list, create, read (also an older version with ?version=N), update, delete; content/{id}/child, /descendant/page, /ancestor, /history, /version; content/{id}/move/{append|above|below}/{target}
Commentscontent/{id}/child/comment, including replies and inline comments; created with POST content and type: "comment"
Attachmentscontent/{id}/child/attachment — upload, list, replace; content/att{id}; /download/attachments/{pageId}/{filename}
Labelscontent/{id}/label — list, add, remove
Restrictionscontent/{id}/restriction — who may read and who may edit a page
Spacesspace, space/{key}, space/{key}/content
Searchsearch and content/search with cql — see below
Peopleuser/current, user, search/user, group
Exportexportword?pageId=… — a page as a Word document

Lists page with start and limit (25 by default, at most 200) and return the paged envelope with results, size and _links. expand works as in the original.

What a page body may be

  • storage — the wiki’s XHTML storage format, kept as sent.
  • markdown — converted to storage when saved. Headings, lists, tables, links, code, and formulas in $…$ and $$…$$.
  • wiki — read as Markdown too, not as the original wiki markup.
  • A document object (atlas_doc_format) is not converted: do not send one.

Every save is a new version. An update must carry the next version number: one that is not greater than the current number is refused with a 409 — somebody else saved in between; read the page again and retry.

A page may hold up to 512 KB of text, a comment up to 100 KB, an attachment up to 100 MB. Uploading a file with a name the page already has replaces it as a new version.

Where it differs

  • Pages and comments only: no blog posts, whiteboards or databases. Creating any other type is a 400.
  • Content properties are always empty.
  • No comparison of versions: fetch both with ?version=N and compare them yourself.
  • Search has no relevance score: results come newest-modified first unless ordered.
  • The home page of a space cannot be deleted or restricted.
  • A page is answered with a 200 when created, not a 201.

Search (CQL)

FieldCompared against
space (or space.key)the space key
typepage
titlethe title
textthe title, the text, the labels — and the words in diagrams attached as SVG
labelany single label
creatorthe username of whoever created the page
contributorthe username of whoever edited it last — not everybody who ever did
ancestora page id anywhere above
parentthe id of the page directly above
idthe page id
created, lastmodifieda date
  • Operators: =, !=, ~ (contains, ignoring case), !~, IN, NOT IN, and >, >=, <, <= on dates.
  • AND, OR, parentheses. There is no NOT.
  • Functions: currentUser(), startOfDay(), and now("-7d") — with m for minutes, h, d, w and y.
  • ORDER BY created, lastmodified, title, space or id, with DESC if wanted.
  • Not understood: favourite, watcher, mention, macro, container, and a NOT in front of a group.

As with the tracker search, a CQL query is never refused: a field that is not in the table above is ignored and matches every page.

Something missing, or not as described here? Write to hello@kaiku.tech