Remote blog writing under Drupal 7 - Mars Edit & me
For several years, I've been using and recommending the excellent Mars Edit for folks who want to write blog posts offline for later uploading.
There are several reasons for people to want to do this - for one thing you can work on several articles at once, without having to flip between browser tabs. Also the better offline editors have good media management, allowing the user to upload images from the desktop easily, and in some cases even pull from iPhoto, or from previously published stories, without breaking the flow of writing. Even the best WYSIWYG editors that work in-browser can't quite match the ease of use and basic unobtrusiveness of a good offline editor.
One user has also points out that she feels safer having a local copy of her posts available as backup, or in case she wants to pull a bunch of posts together for a story collection or a book.
In any case, offline editors are popular, and Mars Edit is one of the best (Mac only, sorry).
So when I recently updated this site to Drupal 7, I figured everything would Just Work, as they say - silly me. There are some configuration issues on the Drupal side that have kept me busy today - nothing that was Mars Edit's fault. It all comes down to setting up BlogAPI correctly.
Just by way of background: Drupal requires the addition of the BlogAPI module in order to provide a web service that allows remote posting in the manner we're looking for here. BlogAPI will accept POST methods, authenticate the user, parse the provided xml, and create or update the node for you. It will also accept images and put them in the Drupal file hierarchy, so that they can be referenced by your post. However, these images need to be encoded as text, because of the xml-based conversation that it's having with the remote client.
Drupal uses the Movable Type API, which is quite well supported generally, and Mars Edit is smart enough to know that - so that when you set up your blog account in Mars Edit for the first time, it generally gets the settings correct.
There are a few gotchas though, and as I spent a good few hours on this, I thought I'd share:
Firstly, you need to get BlogAPI installed. Install it as you would any other Drupal module, but be sure to turn on the supporting API providers - MetaWeblog and Movable Type - in the Modules list. Apparently we need both, as some key functions seem to reside in MetaWeblog.
Next, be sure to grant permissions. This may seem obvious, but I spent a frustrating hour trying to post images as the superuser, and failing. Even if your account is UID=1, you'll still need to create a role, add yourself to it, and give it perms for BlogAPI. If you don't, you'll be able to post text just fine, but BlogAPI will refuse your images, because you won't have a valid file upload limit.
If you'd like to be able to push posts up in Draft (unpublished) status, you'll need "Administer Content" perms as well - grant that to your role, again even if you're user #1.
Finally, if you're getting complaints about the SQL schema, as I was, just uninstall BlogAPI (that means uninstalling the providers first - and I do mean uninstall at /admin/modules/uninstall, not just "turn off"). Turn BlogAPI back on again, and it will re-make the database tables it needs. You will then have to reactive the providers, and set everything up again at /admin/config/services/blogapi. I think this may have something to do with the update - perhaps the BlogAPI updater doesn't quite handle the jump from D6 to D7. Anyhow reinstalling solved it for me.