Step 1
Download the latest release of JoeBlogs from Codeplex
(Click the Downloads tab, and select the latest download)
Step 2
Unzip the contents of the downloaded zip file.
(I usually copy DLLs I am going to use into a “lib” folder at the root of my solution)
Step 3
Add a reference to BOTH CookComputing.XmlRpcV2.dll AND JoeBlogs.dll

Include AlexJamesBrown.JoeBlogs in your class, with using / Imports:
C#
using AlexJamesBrown.JoeBlogs;
VB
Imports AlexJamesBrown.JoeBlogs
Step 4:
Instantiate a new Wrapper object.
So far, the available wrappers are:
MetaWeblogWrapper
WordPressWrapper
C#
WordPressWrapper wrapper = new WordPressWrapper(Url, Username, Password);
VB
Dim wrapper As New WordPressWrapper(Url, Username, Password)
Please note –
The above example has the Url, Username and Password strings omitted. Simply replace them with the relevant information.
Step 5
You can now take full advantage of all the methods on your instantiated wrapper.
C#
string Url = "www.alexjamesbrown.com"; string User = "MyUser"; //enter your username string Password = "MyPassword"; //enter your password var wp = new WordPressWrapper(Url, User, Password); //a few test functions... var userBlogs = wp.GetUserBlogs(); var tags = wp.GetTags(); var categories = wp.GetCategories(); var authors = wp.GetAuthors();
[…] here for usage instructions: http://www.alexjamesbrown.com/geek/using-joeblogs/ Share […]
Hi,
Noticed your source code is missing a class “BaseWrapper” on the latest version.
Thanks for the notification.
I’ve added the missing file to revision 25150
Hi,
Implementation of Get Posts is mising.
Feel free to implement it, the code is on github, and you could submit a pull request
do you support other blog system beside wordpress?
yes, anything that supports the metaWeblog API
What blog system are you using?
I get an exception “Response XML not valid XML-RPC – missing methodResponse element.” if i place a breakpoint here:
try
{
BlogID = GetUserBlogs()[0].blogid;
}
catch(Exception ex)
{
BlogID = string.Empty;
}
Thanks anyway its an easy to use solution (if i get it to work)
I get:
XmlRpcIllFormedXmlException: Response from server does not contain valid XML.
from:
var userBlogs = wp.GetUserBlogs();
i tried both the wp blog i have at wordpress.com and one hosted on my own site, got the same result.
im getting a few errors like this recently…
I’ll check over the code – i’m thinking maybe an update to wp has broken it?
What version are you running?
This is both from the current version of wordpress.com, and version 2.8.1 on my hosting site
Thanks for reporting the error – it is now fixed.
Please see this post:
http://www.alexjamesbrown.com/geek/development/dotnet/joeblogs-typo-in-dummy-url-fixed/
Do you have a sample code for posting new post with categories included?
It errors out for me with “Response from server does not contain valid XML.”
Hi, does your wrapper has that NewPost function implemented? I can’t get it to work 🙁 Pls help
Nevermind my previous post – I got it to work.
But I have another problem – in your wrapper there’s no way to add tags to new post or edit them, but I found that it can be done with the struct “mt_keywords”, I think it can be easily added to your wrapper, but I don’t have the possibility to test it since I have Visual Studio 2005 only, and your project was done in VS 2008 (??). So could you check if adding:
public string[] mt_keywords;
in the Page.cs file (under the Page structs section) would work for adding tags to new post? I think it should, as I’ve read about it, but I can’t check it right now.
@Milo can you tell me how NewPost function works?
Hi,
I wrote a post on using the NewPost method:
http://www.alexjamesbrown.com/development/creating-a-new-post-in-wordpress-using-the-joeblogs-library/
hi there, great extension..i would like to ask something..the getPost() throws an error when executed. it seems that the response contains an integer when the struct expects a string..would you mind looking into this? thank you so much..:)
Please assist how GetOptions work?
hello dear,
i had used your dll for publishing post on the ‘wordpress’ account, and they worked perfectly. very good job indeed. can you please confirm if your dll works for Live Journal also. if yes can you give me sample code.
look forward to hear from you soon.
regards
navjot
Hey Alex –
Great job – really great! I was working with WordPress.NET, but got hung up on the limitation of having to hard code the URL, username and password. I am an intermediate C# developer. Many of the techniques of mapping Interface methods to the XMLRPC dll are brand new and a bit fuzzy. Your tool is a great find.
Thanks,
Sean Olson
Hello,
this VB code works fine for me to add a new post.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim wrapper As New WordPressWrapper("http://myblog/xmlrpc.php", "admin", "secret") 'create a new post Dim post As New Post() post.dateCreated = DateTime.Now post.title = "This is a title" post.description = "this is the body of the post. it <strong>could</strong> be html Rev." post.postid = "12345678" wrapper.NewPost(post, True) End SubIs there any sample code for editing an existing post? I want to modify a post from VB, but I am not sure how to get the postid. Would it be possible to search for the ID of a post? I do have the post title, but not the ID.
You are a legend Alex.
Many thanks for creating this great/simple/clean plugin.
Perfect for just a few simple things like “Displaying the latest posts automatically from your wordpress blog on your ASP.Net main site”..
[…] Alex James Brown » Using JoeBlogs -metaWeblog API Wrapper […]
Hello!
Using:
wrapper.GetPostStatusList(this.BlogID, this.Username, this.Password);
error occurred:
response contains struct value where array expected (as type String[]) [response]
Hi,
Have you got any examples about UploadFile function ?
Thanks !
[…] alexjamesbrown.com | Alex James Brown » Using JoeBlogs -metaWeblog API Wrapper […]
Hi
I am tring but not able to upload the file (jpg) with the post.
ANy can please help me with it.
Upload class needs the data class and I am not able to give the local file path to data class.
Any one please help.
Hey, I attempted to e-mail you concerning this post that i’ve some inquires, but can’t seem to reach you. Please email me when have a moment. Thanks.
Hi, sorry- I will contact you by email
Hi, really cool API! I have a problem though… I’m trying to create a new page but I get the error “The method or operation is not implemented”.
I’m doing it like this:
var wp = new WordPressWrapper(Url, User, Password);
Page page = new Page()
page.page_id = “1”;
page.wp_slug = “Slug_text”;
page.wp_password = “mypassword”;
page.wp_page_parent_id = 0;
page.wp_page_order = “0”;
page.wp_author_id = “0”;
page.title = “Title text”;
page.description = “The main post text…”;
page.excerpt = “Excerpt…”;
page.text_more = “Text more…?”;
page.mt_allow_comments = 0;
page.mt_allow_pings = 0;
page.dateCreated = DateTime.Now;
page.page_status = “Published”;
wp.NewPage(page);
Am I missing something? I create posts easy enough, but the page woun’t work… please advice.
Is there a pdf or something that I’ve missed on how to use the API? Some kind of document would be sweet!
Hi,
I haven’t got round to properly documenting this API yet –
I suspect, the method you are trying to use hasn’t yet been written –
I’ll try and take a look today.
Hi again Alex. Another question, when posting I’, trying to add a category but I get an error when I try to. First I do this:
post.categories = “Uncategorized”;
But it complains that I can’t convert type ‘string’ to ‘string[]’. But when I do it like this:
post.categories[0] = “Uncategorized”;
I get an object not set to an object reference or something… how do I post the category?
Thanks… I would loooooove if you got to creating some kind of pdf reference for this man. Really cool stuff!
Johan
It’s asking for a string array so something like this would work:
post.categories = new string[] { “Uncategorized” };
Although if you just don’t supply a category the post will already be created as Uncategorized.
Hi!
First of all thank you for the great job!
I’m using NewPost with wordpress and it works fine, but when it comes to post something like the embed below, it posts nothing:
I think the problem is the ‘&’ of flashvars. I there a way to make it work? (using c#)
Thank you!
Hi, I would also love to see an UploadFile example. Any chances of you publishing it on the blog or could you email me? Keep up the good work. With some documentation and examples this project would be outstanding.
I’m almost there:
var data = new AlexJamesBrown.JoeBlogs.Structs.Data();
var wp = new WordPressWrapper(Url, User, Password);
UploadImage = FiletoBase64(FileName);
data.name = “test.jpg”;
data.type = “image/jpeg”;
data.overwrite = true;
data.base64 = UploadImage;
wp.UploadFile(data);
The file gets created and added to the media library but is zero bytes in size. I hints as to what could be wrong?
/Jonas
System.NotImplementedException
Satır 63: Response.Write(wp1.NewPage(page));
[NotImplementedException: Yöntem veya işlem uygulanmadı.]
AlexJamesBrown.JoeBlogs.WordPressWrapper.NewPage(Page page) +52
I would be glad if you have time. Thank you in advance.
Add new post to my problem. To add a post NewPost (post, true); was a simple but not enough.
Instead, NewPage (page), but always get an error I want to use.
NewPage (page) to make lessons relevant example is it possible?
I’ve tried all sorts but I failed … My code below.
AlexJamesBrown.JoeBlogs.Structs.Page AlexJamesBrown.JoeBlogs.Structs.Page page = new ();
/ / Page.custom_fields = customf;
page.page_id = “1″;
/ / Page.wp_slug = “Slug_text”;
/ / Page.wp_password = “mypassword”;
/ / Page.wp_page_parent_id = 1;
page.wp_page_order = “1″;
page.wp_author_id = “1″;
page.title = “Title text”;
page.description = “The main post text …”;
/ / Page.excerpt = “Excerpt …”;
/ / Page.text_more = “text more …?”;
page.mt_allow_comments = 0;
page.mt_allow_pings = 0;
page.dateCreated = DateTime.Now;
page.page_status = “true”;
Response.Write (wp1.NewPage (page));
I have currently integrated your MetaWeblog wrapper for our wordpress blog here at work.
It works great besides one small issue. I am calling the GetRecentPosts method and it returns all posts (draft and nondraft posts). However, the Post object does not have the publish boolean field. Is there any way you can add this field so the returned posts can be filterd depending on published field
Thank you!!! This has enabled me to throw together in one evening a customized blogging application to create a three month photo essay. The application hugely streamlines the process making it easy to upload pictures with a few sentences of text.
Andy
I’ve been struggling with uploading images and adding categories. Do you have some sample code or a sample project that shows how to accomplish both of these tasks? Thanks!
Woot! I was able to upload a file using the following few lines:
AlexJamesBrown.JoeBlogs.Structs.MediaObject newMediaObj = new AlexJamesBrown.JoeBlogs.Structs.MediaObject();
newMediaObj.name = “image.jpg”;
newMediaObj.bits = imageBytes;
newMediaObj.type = “image/jpg”;
AlexJamesBrown.JoeBlogs.Structs.MediaObjectInfo objInfo = wp.NewMediaObject(newMediaObj);
Now if there was only a way to get the status of a post…
Oh, and the whole “add a new category” thing.
I’ve tried this wrapper on 3 of my blogs. The main http://lifeofajackass.com
I get this error: Response from server does not contain valid XML.
The option is on for all the blogs, and XML-RPC is used with other services. Can you please help?
hi, nice code, thx for sharing
btw , how to get result after posting.
to check success or not
ahhhhh…. after digging around i discover my images have indeed been uploaded but are not “attached”… so if i may i would like to change my question to how do i attach them to “today”.. many thanks Pete
got it, wp.post html for MediaObjectInfo.url attaches it
Hi, is there any c# api to post comments on any wordpress site???
i am using this method
public string NewComment(string postid, Comment comment)
{
return wrapper.NewComment(this.BlogID, this.Username, this.Password, postid, comment)
.ToString();
}
I am using the WordPress API Wrapper. The user I am using is an Adminstrator to the site. I am using a wordpress.com site, so how do enable it to allow these?
[403] You are not allowed access to details about this site. GetPostStatusList(), GetCommentCount(postID)
[401] Sorry, you cannot edit this post GetPost(postid),
GetRecentPosts(numberOfPosts) always returns list of size 0
XML-RPC needs to be enabled-
I’m not sure of how to do this on wordpress.com, as opposed to self-hosted wordpress – or if it’s even possible.
It is something I’ll need to try out though
Hi Alex,
I have installed wordpress on ….i have a wordpress directory created…Now i want to create a new page using wp.newpage function….which sub directory i need to place this code file…and how to call the newpage function….
i have pasted the code below which is supposed to create a new page…but i have no idea how to use this code…i cant find any IXR_Library.inc.php and xmlrpc.php files in my wordpress directory anywhere…
“New Page Test”,
“description” => “Hello there, this is a test.”
);
$rpc = new IXR_Client( $rpc_url );
$status = $rpc->query(
$method_name,
$blog_id,
$username,
$password,
$post,
$publish
);
if( !$status ) {
print “Error in RPC request\n”;
print_r( $rpc );
exit;
}
print_r( $rpc->getResponse( ) );
print “\n”;
Hi,
Is it possible to add or edit a post with tags and custom fields? There is an option for this while adding page, but I need to add post with tags and custom fields.
Please help!
Hi Alex,
Thanks for posting such a great article… I tried to call the get post method like below…
var wp = new WordPressWrapper(“myrul”, “username”, “pwd”);
var userBlogs = wp.GetPost(“528″);
But I am getting an error like ” response contains int value where string expected [response : struct mapped to type Post : member postid mapped to type String] ” ..How do I make it work ?
Also If I post an entry from your API how do I get the URL of the new post along with the post status(either draft / publish..). Is there any way I can get the same.. please help me.. and keep up your great work.
Looking forward from you
Thanks
Deepu
Hi.
How I can add excerpt for my post with your wrapper?
Thanks
how do we get about the ping method? Can you implement it?
Cool stuff alex.. Do you know what platforms this can be used on?
I know it can be used on blogger and wordpress.. but what others? is there a way i can find out…
This would save me a lot of effort doing manual posts to them when I can just create a little app and point to the site and article and post 🙂
thanks
Steve
Hi,
It works with the metaweblog api.. so if the blog implements it, it’ll work
You’ll just need to use the other wrapper.
I’m going to have more examples in the next release.
What blog platform are you using?
mainly tumblr,xanga, wordpress and livejournal
I think tumblr and xanga may be weblog?