It's better when it's simple

User Tools

Site Tools


Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community

Follow us on Facebook, Twitter and other social networks.

Our Privacy Policy



Samples of Clients using the XML-RPC Api

Beside the simple clients listed below, there is also available:

Sample Java Client

A java client for Dokuwiki is available on github.

Example which displays the title of the wiki and the list of its pages:

import dw.xmlrpc.DokuJClient;
import dw.xmlrpc.Page;
public class Main {
  public static void main(String[] args) throws Exception{
    String url = "http://mywiki/lib/exe/xmlrpc.php";
    String user = "myUser";
    String pwd = "myPassword";
    DokuJClient client = new DokuJClient(url, user, pwd);
    System.out.println("Pages in the wiki " + client.getTitle() + " are:");
    for(Page page : client.getAllPages()){

Sample PHP Client

This simple example will pull the version information from the given DokuWiki.

  • You need to download and install the library XML-RPC for PHP for this example.
  • The URL of the DW-Server must be given without the procotol (http://).
include('lib/');  // or whereever you have downloaded and put the XML-RPC for PHP libraries
// create a new client instance
$c = new xmlrpc_client('/lib/exe/xmlrpc.php', '', 80);
// enable debugging to see more infos :-) (well, not for production code)
// create the XML message to send
$m = new xmlrpcmsg('dokuwiki.getVersion');
// send the message and wait for response
$r = $c->send($m);
if($r == false) die('error');
    // seems good. Now do whatever you want with the data
    $v = php_xmlrpc_decode($r->value());
    echo "$v";
$c = new xmlrpc_client('/lib/exe/xmlrpc.php', 'localhost', 80);
$c->setDebug = 1;
$m = new xmlrpcmsg('wiki.putAttachment');
$m->addParam(new xmlrpcval("file.png", "string"));
$m->addParam(new xmlrpcval("iVBORw0KGgoAAAANSUhEUgAAADAAAAAwC.....<base64 string here>...", "base64"));
$m->addParam(new xmlrpcval(array("ow" => new xmlrpcval(true, "boolean")), "struct"));
$r = $c->send($m);
if($r == false) die('foo!');
// Output the response object
// var_dump($r);
$r = $c->send($m);
if(!$r->faultCode()) {
    $v = php_xmlrpc_decode($r->value());
    echo $v;
} else {
    echo $r->faultString();

DokuWiki has its own XML-RPC library which could also be used. A simple client using that library looks like this:

$client = new IXR_Client('http://localhost/devel/dokuwiki/lib/exe/xmlrpc.php');
$client->debug = 1; // enable for debugging
$ok = $client->getResponse();
if($ok) {
   echo $client->getResponse();

Sample Perl Client

Dokuwiki::RPC::XML::Client is simple dokuwiki client written on top of RPC::XML::Client, it comes with a CLI command you can use from shell.

you can also write RPC::XML::Client code directly following this simple example will pull the version information and the list of documents in the wiki namespace from the given Dokuwiki. It also lists all .png mediafiles from the same namespace and its child namespaces.

use strict;
use warnings;
use feature 'say';
use RPC::XML::Client;
use Data::Dumper;
my $client =
my $res = $client->send_request('dokuwiki.getVersion');
say 'dokuwiki.getVersion = ' . $res->value;
my $namespace = 'wiki';
my $req =
  RPC::XML::request->new( 'dokuwiki.getPagelist',
    RPC::XML::struct->new() );
$res = $client->send_request($req);
say "dokuwiki.getPagelist = \n" . Dumper $res->value;
# if given and >0 'depth' is relative to the searched namespace and is a maximum.
# setting 'hash' to 1 will put extra load on server.
$res = $client->send_request(
	RPC::XML::request->new( 'wiki.getAttachments',
		RPC::XML::struct->new( {depth => 2, skipacl => 1, hash => 0, pattern => '/\.png$/' } )
say "wiki.getAttachments = \n" . Dumper $res->value;

Sample Ruby Client

This simple example will pull the version information from the given Dokuwiki. No plugin required (in the Windows default package).

require "xmlrpc/client"
server = "localhost","/dokuwiki/lib/exe/xmlrpc.php")
rescue XMLRPC::FaultException => e
    puts "Error:"
    puts e.faultCode
    puts e.faultString

This example demonstrates how to upload attachments:

require "xmlrpc/client"
server = "localhost","/dokuwiki/lib/exe/xmlrpc.php")
    puts"wiki.putAttachment", "wiki/example.png","/path/to/example.png")))
rescue XMLRPC::FaultException => e
    puts "Error:"
    puts e.faultCode
    puts e.faultString

Sample jQuery Client

var xml='<?xml version="1.0"?><methodCall><methodName>wiki.getRPCVersionSupported</methodName><params></params></methodCall>';
   url: "http://<your wiki>/wiki/lib/exe/xmlrpc.php",
   data: xml,
   beforeSend: function (xhr) {
     xhr.setRequestHeader ("Authorization", "Basic " + btoa('username' + ":" + 'password'));

Python Module

A Python module for DokuWiki's XML-RPC API can be found at the Python package index and on GitHub.

Alternative: python-dokuwiki

Sample AutoIt3 Client

My AutoIt3 client is mainly a proof of concept:

#cs ----------------------------------------------------------------------------
 AutoIt Version:
 Author:         Hugo Bossard
 Script Function:
    XML-RPC sample client AutoIt3 script.
#ce ----------------------------------------------------------------------------
; this script uses the UDF WinHttp
#include "WinHTTP.au3"
; get the info from page 'wiki:syntax' using wiki.getPageInfo()
$Xml = '<?xml version="1.0"?>' 
$Xml = $Xml  & @CRLF & '<methodCall>'
$Xml = $Xml  & @CRLF & '<methodName>wiki.getPageInfo</methodName>'
$Xml = $Xml  & @CRLF & '<params>'
$Xml = $Xml  & @CRLF & '<param>' 
$Xml = $Xml  & @CRLF & '<value>'
$Xml = $Xml  & @CRLF & '<string>wiki:syntax</string>'
$Xml = $Xml  & @CRLF & '</value>'
$Xml = $Xml  & @CRLF & '</param>' 
$Xml = $Xml  & @CRLF & '</params>' 
$Xml = $Xml  & @CRLF & '</methodCall>'
$XmlSize = StringLen($Xml)
; initializes the use of WinHTTP functions and returns a WinHTTP-session handle.
$hw_open = _WinHttpOpen()
; creates a HTTP request handle to a lokal DokuWikiStick installation on port 8800
$hw_connect = _WinHttpConnect($hw_open, "localhost", 8800)
; creates a HTTP request handle
$h_openRequest = _WinHttpOpenRequest($hw_connect, "POST", "/lib/exe/xmlrpc.php", "/RPC2 HTTP/1.0", "localhost", "text/xml")
; sends the specified request to the HTTP server
_WinHttpSendRequest($h_openRequest, "", $Xml, $XmlSize)
; waits to receive the response to a HTTP request initiated by WinHttpSendRequest().
$Data = ""
  ; reads data from a handle opened by the _WinHttpOpenRequest() function.
Until @error
; close connection and clean up
; show error number and resulting data
MsgBox(4096,"Error: " & @error, $Data)

Sample Emacs Lisp Client

(require 'xml-rpc)
(defvar *dokuwiki-xml-rpc-url* "https://dokuwiki.url/lib/exe/xmlrpc.php")

PowerShell Module

A PowerShell client for Dokuwiki is available on the powershell gallery and on github.

devel/xmlrpc/clients.txt · Last modified: 2019-02-04 23:10 by andy93