Manipulate Your Blog with MetaBlog API for C#

3 בדצמבר 2007

2 comments

Manipulate Your Blog with MetaBlog API for C#

What is the MetaWeblog API?

The MetaWeblog API (MWA) is a programming interface that allows external programs to get and set the text and attributes of weblog posts. It builds on the popular XML-RPC communication protocol, with implementations available in many popular programming environments. Read more here

Since this API is exposed from the Weblogs providers, programmer have to use a client-side programming model to communicate with it according to the XML-RPC protocol. Josh Gough has created and published this C# programming wrapper which allows us to easily develop C# client applications that consumes this API via a service.

How do you get started ?

  1. Download the Community Server MetaWeblog Proxy assemblies.

  2. Create a .Net application and reference the CookComputing.XmlRpc that come in the above .zip file.

  3. Create a class for the API provided by Josh Gough. You can copy the contents of the API from his post.

  4. Notice that the above post contains an implemention of IBlogger interface, which is decorated with [XmlRpcUrl("…metablog.ashx")] attribute. Don't forget to change the URL of your Community Server Blogs metaBlog.

  5. Now you can easily use the proxy in your code.

For example:

IBlogger proxy = MetaBlogAPIFactory.Create();

Post[] posts = proxy.getRecentPosts("bursteg", "username", "password", 1000);

 

var query = from p in posts

            where p.categories.Contains("VS2008")

            select new { Title = p.title, Link = p.permalink };

 

this.GridView.DataSource = query;

this.GridView.DataBind();

and with a little LINQ syntax, you can create a new query and show bind it to a grid.

Enjoy!

Add comment
facebook linkedin twitter email