What is it?

XmlRpc is an API to remotely call an application, remote procedure call, embedded in XML, usually transported over the net via HTTP. This sounds complicated when you first hear about it.

The good news is that wiki XmlRpc is very easy to use, it doesn't require XML, RPC or HTTP protocol knowledge.

XmlRpc is for calling remote procedures (it internally uses XML and http(s)).

Wiki XmlRpc is a standard for a interface to a wiki using xmlrpc.

Usage cases:

Example code

   1 import xmlrpclib
   2 srcwiki = xmlrpclib.ServerProxy("http://mywiki.org/?action=xmlrpc2")
   3 
   4 allpages = srcwiki.getAllPages()
   5 for pagename in allpages:
   6     pagedata = srcwiki.getPage(pagename)
   7     print "Got %s." % pagename
   8     print pagedata

That's all you need to get the complete content of a wiki via Wiki XmlRpc. All results will be utf-8 encoded, so make sure your terminal supports them (or add .encode('iso8859-1') to the strings).

MoinMoin Wiki XmlRpc versions

Note that XmlRpc putPage does not use the page name you give as parameter but PutPageTestPage - except if you change the code in wikirpc.py (on your own risk). This is to avoid major problems until the code is better tested / security checked.

v1

MoinMoin/wikirpc.py implements version 1 of the wiki xmlrpc standard (you get it by action=xmlrpc).

Using v1 is relying on a ready-to-use standard. But it is also a bit strange, because when v1 was made, the XmlRpc specification defined String type to be ASCII. Because of that, v1 had to encode (utf-8) strings either as URL encoding (using %XX) or base64 encoding - and that was a bit annoying (especially regarding python XmlRpc by default uses XML with utf-8 encoding anyway).

v2

MoinMoin/wikirpc.py implements upcoming version 2 of the wiki XmlRpc standard (you get it by action=xmlrpc2).

As the XmlRpc standard changed to drop the demand for a String to be ASCII-only, v2 will use UTF-8 Strings directly with no encoding. That's much more comfortable to use. base64 might be used for binary files like attachment, but not for page names or page content.

Also, v2 will have some other features not implemented yet.

Extensions

Links

Ideas

LionKimbro had the good idea to modularize XmlRpc using plugins dynamically loaded like it is done for macros currently - this is implemented in moin 1.2 and later.


How to tell whether a page exists or not?

A script to append to wiki pages first calls getPage - but getPage fails & returns a dict instead of string if the page doesn't exist

One can test whether the result of getPage was a string & use '' if not - but this risks replacing the entire page incase of some other error

Would be nice to explicitly check whether the page exists or not

Thanks! -- JackBates 2005-11-26 04:19:47

Authentication

For Apache based servers, http auth should work. See the examples in MoinMoin/scripts/xmlrpc-tools.

For Twisted server, moin 1.3 supports getting the user name, but not the password. This is why there are those insecure and trusted config switches - you need them for that case (see also MoinMoin/wikirpc.py, search for putpage).

For moin 1.5 we try to make both Apache and Twisted working correctly with http auth.

There are APIs for doing authentication within a script.

For example, in python3:

   1 token =  srcwiki.getAuthToken("ElmerFudd", "elmerspassword")
   2 srcwiki.system.multicall([{'methodName':'applyAuthToken', 'params': [token]}, {'methodName':'putPage', 'params': ['SomePageName', 'Fnord']}])


How about the case that the user authenticates to the WikiRpc script - or the script performs some action like verifying a PGP signature & obtaining the signer's wiki username

In this case the script authenticates to the wiki using http auth, but needs to set the acting username for changes to be correctly attributed

Is this possible? - putPage lacks an argument for the username making the change

-- JackBates 2005-11-23 23:09:48

v3?

Can do the changes for the search stuff (xapian excluded), but I have no knowledge on or testing environment for the authentication stuff... -- OliverSiemoneit 2006-12-04 17:18:48

Here is a first version for the new search functions.. but I did not test them.. wikirpc.py -- OliverSiemoneit 2006-12-04 19:36:00

Users

What users does this functionality have? That is, who's using it, and what for? I didn't find any obvious place to look for what I've written, nor to see it's duplicated work. AndersEurenius

Extra actions

MoinMoin wiki xmlrpc support has plugin architecture. There is one project providing a set of xmlrpc plugin. The plugins allow user to 'rename', 'delete', 'putNameWithAttributes' via xmlrpc.

Using XML-RPC to read/list/rename/save

I've spent some times to get MoinMoin remoting (with auth) possible. I have write-up the details on here: http://www.nixstyle.net/moin/TechNotes/MoinMoin/RemotingWithXmlRpc

You can also found a script which wrapped the 'read'/'list'/'save'/'rename' operations.

MoinMoin: WikiRpc (last edited 2013-02-23 06:51:40 by modemcable165)