A RESTful wrapper for MoinMoin

By Uche Ogbuji
February 3, 2009 | Comments: 2

I've always loved the MoinMoin wiki, and lately I've been using it for more and more, at work and at home. I've pined for a REST wrapper for a while, and I finally bit the bullet and wrote one, as part of the open-source Akara project, which among other things provides RESTful access to the XML processing capabilities of Amara 2.x. The MoinMoin wrapper is a WSGI app, so should be easy to work into other projects.

I learned quickly how alone I was on the task. There are some WikiRPC bits for MoinMoin is varying levels of disrepair, but yuck! XML-RPC? I considered wrapping editmoin, but in the end figured a completely decoupled wrapper makes the most sense. I looked for any noodlings in official Moin-space, and came across this IRC log. Start at 2008-03-26T02:29:07. Thomas Waldmann is the lead developer of MoinMoin, and clearly a genius and a great guy, but it's painful to watch his dismissal of REST. To be fair, he could have used a better explanation. I hope my work provides a bit of inspiration.

You can use the module to do stuff like:

curl -u JohnDoe:passwd -p --request PUT --data-binary "@wikicontent.txt" --header "Content-Type: text/plain" "http://localhost:8880/FooTest"

To update a wiki page, fully authenticated and all. By the way, Wiki over REST is an interesting test case of PUT versus POST. As you can see I went with PUT, since in theory a wiki page URL always "exists", even if there isn't yet any content for the page (the Web philosophers must love that one).

The code still could use some work, but I've found it a useful enough start to get some nice jobs done, more on which later...


You might also be interested in:

2 Comments

A wiki is an interesting case, because it's one of the few kinds of HTTP servers that allow clients to choose URLs. A "normal" server wants to dictate the URL structure, and so wants new documents to be created only by POST (thus Atom).

I once advised the creators of a Web-wide annotation service to allow only GET, PUT, and DELETE. In principle any Web page could be annotated, whether it existed or not, with an URL something like http://example.com/annotation/http://www.ccil.org/~cowan. A PUT to that would write the annotation for my home page, and a DELETE would remove it. (Each user could only see his own annotations, so there was no need to treat annotations as a collection.)

Some really wonderful ideas you have shared. Great post.

News Topics

Recommended for You

Got a Question?