Publishing blogs from Alfresco to Drupal 7
Both Alfresco and Drupal are great platforms for delivering content to users. Sometimes though, you want to be able to publish content from Alfresco to Drupal 7.
Alfresco Share’s Blog module allows users to create and publish blogs within an Alfresco site. Out of the box, you can also publish blogs to both WordPress and Typepad.
Drupal isn’t a publishing option by default, however, with a few extra modules within Drupal, you can easily publish externally from Alfresco.
Configure Drupal 7
The easiest way to talk to Drupal is to install the Blog API module. This API module exposes MetaWeblog API via the XML RPC handler within drupal and allows you to update an external blog accordingly.
This makes the assumption that you are using the generic blog type within drupal.
Install the following modules from Drupal:
Enable the following modules once installed:
- MetaWeblog Provider for BlogAPI
- Old Blogger Provider for BlogAPI
- From Configuration, select BlogAPI under Web Services
- Select MetaWeblog as the Default provider
- For Node Types, select blogs
- Save the configuration
Alfresco does not need much configuration at all, as it already supports publishing to WordPress out of the box, we can reuse this functionality for drupal.
Add Blogs to a Site
If you haven’t already, add blogs to a site by doing the following:
- Navigate to a Site Dashboard
- Select Customize Site
- Drag and Drop Blog from Available Site Pages to Current Site Pages and click OK
Configure External Blog
From the Blog Page, click Configure External Blog and use the following settings:
- Type: wordpress
- ID: blogs (This must match the content type in Drupal)
- URL: http://example.com/
Fill in name and description to whatever you wish, and set the Username and Password to someone who has permissions to create blogs within Drupal. Change example.com to the URL of your drupal website.
If you’ve configured both Drupal and Alfresco, you are free to test! Create a new blog within Alfresco and click Publish Externally. If it all works, then you will have published your first blog from Alfresco.
If things go wrong, or you’re not able to publish your blog for some reason, you can troubleshoot in the following way.
Testing the correct URL
You should be able to confirm you have the correct URL by going to the following link in any web browser:
You will receive the following message back:
XML-RPC server accepts POST requests only.
Testing Drupal’s XML RPC handler
Make a POST request to the above URL with one of the following:
List of XML RPC Methods
Get a list of methods from Drupal:
<?xml version="1.0" encoding="UTF-8"?> <methodCall> <methodName>system.listMethods</methodName> </methodCall>
Make a new Blog Post
Example XML RPC for creating a new blog:
<?xml version="1.0" encoding="UTF-8"?> <methodCall> <methodName>metaWeblog.newPost</methodName> <params> <param> <value>blogs</value> </param> <param> <value>username</value> </param> <param> <value>password</value> </param> <param> <value> <struct> <member> <name>description</name> <value>test description</value> </member> <member> <name>title</name> <value>test</value> </member> </struct> </value> </param> <param> <value> <boolean>1</boolean> </value> </param> </params> </methodCall>
Make sure you update your username and password if you are copying the above code.