DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:jsonrpc

This is an old revision of the document!


JSON-RPC API

develonly

:!: note this is currently experimental. Feedback via Github issues is welcome. The interface might still change.

This API provides access to all remote API functionality described in XML-RPC using a more modern JSON based API.

Get It Working

  1. Set the remote option to enable JSON-RPC in the Configuration Settings “Authentication” section
  2. Set the remoteuser option with a mix of comma separated “usernames,@groups”
  3. For security reasons it's safer to allow access to the JSON-RPC over HTTPS only. DokuWiki's .htaccess.dist contains some rewrite rules to do that.
  4. If you want to access the API from JavaScript, you might want to tune the remotecors option

Accessing The JSON-RPC Interface

You can access the JSON-RPC interface via the following URL:

http(s)://<your wiki/domain/ip>/lib/exe/jsonrpc.php

The function you want to call has to be given as a path segment:

http(s)://<your wiki/domain/ip>/lib/exe/jsonrpc.php/<function>

All parameters are passed as a JSON Array in the body of the request.

Sample JSON Requests

Here is an example of how to communicate with the API using curl:

curl http://localhost/dokuwiki/lib/exe/jsonrpc.php/wiki.getPageInfo \
   -H 'Content-Type: application/json' \
   -H "Authorization: Bearer $token" \
   -d '["wiki:syntax"]'

Please note that the above uses token authentication. Authentication via Basic Auth or Cookies would also work.

Available Functions

Please refer to the description at XMLRPC.

devel/jsonrpc.1701182252.txt.gz · Last modified: 2023-11-28 15:37 by andi

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki