| Subcribe via RSS

Using JoeBlogs -metaWeblog API Wrapper

July 7th, 2009 Posted in Blogging, Geek Speak, Web

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

image

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();
VN:F [1.8.2_1042]
Rating: 9.5/10 (6 votes cast)
VN:F [1.8.2_1042]
Rating: 0 (from 0 votes)
Using JoeBlogs -metaWeblog API Wrapper9.5106
Share this...
  • Facebook
  • Twitter
  • del.icio.us
  • Google Bookmarks
  • LinkedIn
  • email
  • Print
  • Slashdot
  • Digg

22 Responses to “Using JoeBlogs -metaWeblog API Wrapper”

  1. Alex James Brown » C# WordPress Wrapper Says:

    [...] here for usage instructions: http://www.alexjamesbrown.com/geek/using-joeblogs/ Share [...]


  2. Alan Says:

    Hi,

    Noticed your source code is missing a class “BaseWrapper” on the latest version.

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  3. Alex Says:

    Thanks for the notification.
    I’ve added the missing file to revision 25150

    UA:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UA:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  4. Jack Says:

    do you support other blog system beside wordpress?

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  5. Alex Says:

    yes, anything that supports the metaWeblog API
    What blog system are you using?

    UA:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UA:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  6. Felix Says:

    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)

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  7. Atmospherian Says:

    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.

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  8. Alex Says:

    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?

    UA:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UA:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  9. Atmospherian Says:

    This is both from the current version of wordpress.com, and version 2.8.1 on my hosting site

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  10. Alex Says:

    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/

    UA:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UA:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  11. Shawn Says:

    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.”

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  12. Milo Says:

    Hi, does your wrapper has that NewPost function implemented? I can’t get it to work :( Pls help

    UN:F [1.8.2_1042]
    Rating: 5.0/5 (1 vote cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  13. Milo Says:

    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.

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  14. Umair Khan Jadoon Says:

    @Milo can you tell me how NewPost function works?

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  15. Alex Says:

    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/

    UA:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UA:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  16. John Rocela Says:

    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..:)

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  17. Waseem Says:

    Please assist how GetOptions work?

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  18. navjot singh Says:

    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

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  19. Sean Olson Says:

    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

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  20. Oliver Says:

    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 could be html Rev."
    post.postid = "12345678"
    wrapper.NewPost(post, True)
    End Sub

    Is 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.

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  21. Aaron Clausen Says:

    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”..

    UN:F [1.8.2_1042]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.2_1042]
    Rating: 0 (from 0 votes)

  22. Alex James Brown » Using JoeBlogs -metaWeblog API Wrapper | Matt's Tech Notes Says:

    [...] Alex James Brown » Using JoeBlogs -metaWeblog API Wrapper [...]


Leave a Reply