Showing posts with label Live Writer. Show all posts
Showing posts with label Live Writer. Show all posts

Monday, May 26, 2008

What is RSD? Making my Suteki Shop to Live Writer integration slicker.

I recently wrote about how nice it is to use the MetaWeblog API to allow tools like Live Writer update content on bespoke software like my Suteki Shop eCommerce application (which is now morphing into a generic CMS). The one thing I didn't like was the step that requires the user to enter the API their site exposes and it's endpoint:

3_SelectProvider

A little more digging around the Live Writer docs and various blogs led me to discover Really Simple Discovery (RSD). It's an XML schema for describing the APIs that your software exposes by Daniel Berlinger.

In the head of your homepage you have a link to the location of your rsd.xml file:

<link title="RSD" href="http://localhost:63638/rsd.xml" type="application/rsd+xml" rel="EditURI" />

And here's the file itself:

<?xml version="1.0" encoding="utf-8" ?>
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd" >
 <service>
   <engineName>SutekiShop</engineName>
   <engineLink>http://sutekishop.co.uk/</engineLink>
   <homePageLink>http://localhost:63638/home</homePageLink>
   <apis>
     <api name="MetaWeblog" preferred="true" apiLink="http://localhost:63638/metablogapi.aspx" blogID="1" />
   </apis>
 </service>
</rsd>

As you can see it simply contains the web site engine name (suteki shop), the URL of the engine's homepage and the URL of this instance's homepage. Then follows a list of APIs that the engine supports. In my case it's a single entry for MetaWeblog that shows the XML RPC endpoint.

In the case of Suteki Shop, since it's an MVC Framework based application the rsd.xml file itself is generated from a view that simply inserts the current application URL where, in this case, "http://localhost:63638" appears.

Wednesday, May 21, 2008

Using Live Writer to Post Content to a Web Site

I've just added the MetaWeblog API to the Content Management System (CMS) of Suteki Shop. It's most excellent. It means that an administrator can manage the content of the web site using a slick WSYWIG tool like Windows Live Writer. I simply ripped the code for the API from Subtext, a really nice open source blogging application. It took me most of today to get it working, but it'll be a major win for my users who I can't expect to write HTML straight into a web based admin interface.

It's really easy to set up. Simply open up Live Writer and add a new account saying you want to use 'Another weblog service':

1_chooseBlogType

Then enter the URL of the application, here I'm just giving it the URL of the Visual Studio Development Web Server. You also need to enter an admin username (email) and password.

2_HomepageAndLogin

The last step is to tell Live Writer that Suteki Shop uses the Metaweblog API and point it to the XmlRpc endpoint that hosts the API.

3_SelectProvider

After that it's all set up and you can write a post, including images in live writer:

LiveWriterEdit

When you click the 'Publish' button the content magically appears with a new menu item on the Suteki Shop site:

InSutekiShop

You can find my subtext's implementation of the MetaWeblog API the usual place:

http://code.google.com/p/sutekishop/source/checkout

The MetaWeblog API is implemented in the files:

MetaWeblogAPI.cs

MetaWeblog.cs

Note the additional handler in the web.config file:

<add type="Suteki.Shop.XmlRpc.MetaWeblog, Suteki.Shop" path="metablogapi.aspx" verb="*" />