elgg is a PHP-based social networking wonder that we’ve been using at Medullan for some internal stuff lately.  One of my interests was to see what type of tooling could be built around it – desktop widgets, firefox extensions, etc.  It appeared they had a RESTful API of sorts, but the service results were always rendered through the standard HTML view.  Everything I found seemed to say I was stuck with this.  Not so.

If you attach a querystring parameter to your request called view, elgg will output your RESTful service result to any of the supported formats – HTML, XML, JSON, FOAF, etc.

So if I have a method called “print” exposed as documented by elgg, I can have the result returned to me as XML very easily:

http://localhost:8080/elgg/pg/api/rest?method=print&view=xml