Manipulate Your Blog with MetaBlog API for C#
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 ?
-
Download the Community Server MetaWeblog Proxy assemblies.
-
Create a .Net application and reference the CookComputing.XmlRpc that come in the above .zip file.
-
Create a class for the API provided by Josh Gough. You can copy the contents of the API from his post.
-
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.
-
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!