Mark Everard

Hello, I'm Mark – a PhD physicist turned technologist / architect.

Archive for the ‘WordPress’ Category

WordPress XML-RPC ASP.NET Client

with one comment

UPDATED – 7th June 2014 – Additional methods added to client, listed below.

WordPress offers an XML-RPC (AKA SOAP for PhP) API for content retrieval and update operations.

I was pretty surprised to find, or actually not find an ASP.NET client for a WordPress feed. Surely somebody must have faced a scenario of needing to export / migrate WordPress content into a .NET app? Apparently not, or if they have they haven’t shared any code 🙁

So I’ve started putting one together and put the code on GitHub and NuGet. It uses the excellent XML-RPC library for .NET by Charles Cook.

So far I’ve focused only on the read operations, as this suited my original goal of content export. Expanding to cover all of the available methods, including write and delete operations will be straightforward. I’m more than happy to take pull requests 🙂


The WordPress XML-RPC feed by default lives in the root of your WordPress application (/xmlrpc.php), and so at a basic level all you need to provide to download content is a WordPress username / password and the domain that your WordPress instance lives on.

const string baseUrl = "";
const string username = "xxx";
const string password = "xxx";

using (var client = new WordPressXmlRpcClient(baseUrl, username, password))
     var postId = 23;
     var post = client.GetPost(postId);

Current API coverage (as of Nuget package 0.5)

The following methods are supported.

  • wp.getPost
  • wp.getPosts
  • wp.getMediaItem
  • wp.getMediaLibrary
  • wp.getTaxonomy
  • wp.getTaxonomies
  • wp.getTerm
  • wp.getTerms
  • wp.getUser
  • wp.getUsers
  • wp.getComment
  • wp.getComments
  • wp.getCommentCount

Written by mark

September 2nd, 2013 at 11:00 am

Posted in ASP.NET,C#,WordPress