Early developmentNot everything described here has shipped yet.

Skip to content

REST API

NeoWiki's REST API lives under /rest.php/neowiki/v0/* and uses JSON.

By default, reads are public and writes require a logged-in user with edit rights and a CSRF token. Additional permissions might be required depending on the wiki configuration.

You can find all endpoints in the OpenAPI 3.0 description exposed via the REST API itself. Demo wiki example: neowiki.dev/w/rest.php/specs/v0/module/-

Endpoints

Subjects

Read, change, and validate Subjects. New Subjects are created on a page — see Pages and Subjects. For the body shape, see Subject format.

EndpointDescription
GET /neowiki/v0/subject/{subjectId}Fetch a Subject. Optional revisionId; expand with page or relations.
PUT /neowiki/v0/subject/{subjectId}Replace a Subject's label and statements.
DELETE /neowiki/v0/subject/{subjectId}Delete a Subject.
POST /neowiki/v0/subject/validateCheck whether a new Subject is valid, without saving it.
POST /neowiki/v0/subject/{subjectId}/validateCheck whether a change to a Subject is valid, without saving it.
GET /neowiki/v0/subject-labelsFind Subjects of a Schema by label; returns id/label pairs.

Pages and Subjects

A page holds one optional main Subject and an ordered list of child Subjects. These endpoints create Subjects and arrange them.

EndpointDescription
GET /neowiki/v0/page/{pageId}/subjectsList a page's main and child Subjects. expand with schemas or relations.
POST /neowiki/v0/page/{pageId}/mainSubjectCreate the page's main Subject.
PUT /neowiki/v0/page/{pageId}/mainSubjectPromote a child Subject to main, or clear it.
POST /neowiki/v0/page/{pageId}/childSubjectsCreate a child Subject on the page.
PUT /neowiki/v0/page/{pageId}/subjectsOrderingReorder child Subjects and set the main Subject.

Schemas

A Schema defines a Subject type and its properties. For the body shape, see Schema format.

EndpointDescription
GET /neowiki/v0/schemasList Schemas. Paginated with limit and offset.
GET /neowiki/v0/schema/{schemaName}Fetch a Schema by name.
GET /neowiki/v0/schema-names/{search}Find Schema names by prefix.

Layouts

A Layout defines how a Subject is displayed.

EndpointDescription
GET /neowiki/v0/layoutsList Layouts. Paginated with limit and offset.
GET /neowiki/v0/layout/{layoutName}Fetch a Layout by name.

Query

EndpointDescription
POST /neowiki/v0/query/cypherRun a read-only Cypher query against the graph. See Query API.

Stability

Pre-1.0. Endpoints and payloads may change without notice. Don't build third-party integrations on /neowiki/v0/* yet.

Full specification

Every endpoint also publishes a complete OpenAPI 3.0 description: parameters, request bodies, and responses.

Browse it live on the demo wiki: neowiki.dev/w/rest.php/specs/v0/module/-. Paste that JSON into editor.swagger.io or any OpenAPI viewer.

To expose it on your own wiki, register the spec routes in LocalSettings.php:

php
$wgRestAPIAdditionalRouteFiles[] = 'includes/Rest/specs.v0.json';

Then fetch /rest.php/specs/v0/module/- on your wiki.