Elgg Blog: Example of Site Integration Using Web Services

As I mentioned in this blog post, Elgg's web services API can be used to move data between sites. I recently completed a simple example of this for the Elgg community site and this blog. Both of these sites are running on Elgg, but they are on different installs of Elgg. We were adding blog posts on this site, but people using the community site would not necessarily know about them. This is where web services come in.

I wrote some code for the community site that added a web services method that accepts a blog post and posts it in a particular group. You can see a XML description of the new method here. I also added an administrative setting to decide which group gets the blog post.

On the Elgg blog site, I added a plugin that registers a callback for the 'create', 'object' event. This callback checks if this is a blog ready for publishing and if so, pushes it to the web services endpoint of the community site. I choose to encode the data as JSON (Elgg also supports XML and PHP) and I used the PHP extension curl to transmit the data.

To add security for this site to site integration, there is a shared token between the two sites. I could have used Elgg's API authentication for this, but there may be future uses of the web services API that we want to keep separate from this call. That and plenty of testing is all it took.

Now when I post this blog, it will end up in the Elgg News Blog discussion group. This is one small example of what can be done with Elgg's web services API. What are you thinking of building?

  • connectmyschool.com -

    very trivial site right now - only has 2 images showing the schematic for what I had in mind to federate schools' elgg socnet sites so that many schools could become 'friends' or 'affiliates' and allow students access to educational material hosted by the other schools for global benefit.

    A little bit like students being able to walk into the libraries of other schools for research. I just have not had enough spare time to work too much on the code development.. though I did get some XML-RPC communications working between 2 different elgg-based sites.

    My idea then (design stage) was to use XML-RPC to let the different sites communicate and exchange userid data and allow accesses to the local web-site data.

    I had initially started this for a non-profit, non-paying Client - but they seemed to lose interest along the way, but the essential code remains for further development. I've gone thru several server moves so haven't had the time to re-create the elgg<-->elgg federated sites.


  • I recommend using the REST/RPC web services API that Elgg provides. I would only use XML-RPC for legacy applications.

  • LOLZ... Danke!
    My *original code *is legacy... (early 2009 lolz)
    I guess I'm somewhat out of touch - too much of "brains into the code.." 
    Gimme some time to read up more on the REST Remote calls so maybe I will re-code the XMLRPC code and then we see how sweet a song Elgg sings ;-)

  • Top book out there right now on this topic: http://oreilly.com/catalog/9780596529260

    Elgg is using a REST/RPC hybrid right now rather than pure RESTful.

  • I'm a-gonna crash now soon.. teary-eyed, bin sick for several days..
    gonna post more 2morro
    ciao amigos..

Latest comments