Contents
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:
- automatically get pages out of or into a wiki
- automatically get rendered pages out of a wiki
- automatically get link structure out of a wiki
Example code
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
- searchPages(querystring) returns a list of tuples (pagename, text with hightlighting)
- still testing/may change in the near future
Links
WikiRPCInterface (v1) and WikiRPCInterface2 (v2)
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:
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?
Cannot judge that exactly but communication between wikis in a farm and/or with remote wikis seems to grow with comment pages, AccessibleMoin, SisterSites and the idea to use a farm like TWikiWebs or Mediawikis namespaces. This might put forward the need to have an enhanced version 3 of WikiRpc maybe. A version...
that works neatly together with the different authentication methods of Moin, so that e.g. some can also search remote, friendly wikis with FeatureRequests/SearchWikiFarm if he is already validated by NTML
if the user/ rpc caller is authenticated that he also can put a username with put_page? (as wanted by JackBates)
I would like to see that FindPage returns a tuple of (number_pages_searched, search_result_list), also only TitleSearch should be possible with (number_pages_searched, search_result_list), also the retrieving of results of xapian search?? Currently you can get the total number of pages searched only by getting the whole list of pagenames and then doing a len(..) operation on it throwing away the rest. This is not efficient on big wikis gets even worse on remote wikis (much traffic). Partly done except xapian
Is it possible to explicitly check whether a page exists or not in a remote wiki (JackBates)? = Check on existence of SisterSites Is possible!
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.