devel:jsonrpc
This is an old revision of the document!
Table of Contents
JSON-RPC API
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
- Set the remote option to enable JSON-RPC in the Configuration Settings “Authentication” section
- Set the remoteuser option with a mix of comma separated “usernames,@groups”
- 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. - 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