Using JoeBlogs -metaWeblog API Wrapper

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();

71 responses to “Using JoeBlogs -metaWeblog API Wrapper”

  1. Steve avatar
    Steve

    Is there also any way to get the last post full url from the wrapper? I’ve check through and cannot find a way to get this?

  2. Manish Choudhary avatar

    I want to upload image to my blog using your API but what is the field bits in the structure? I converted my file to byte array but the uploaded image is corrupted.
    Help pleaaaaaaaaaaaaaaaaaaaase.

  3. Kay avatar
    Kay

    Have the same problem with invalid XML:

    + $exception {“Response from server does not contain valid XML.”} System.Exception {CookComputing.XmlRpc.XmlRpcIllFormedXmlException}

    I used latest source code.

  4. Kay avatar
    Kay

    Ok, got it working – I stumbled across the url typo 😉

    Retrieving categories and posting in general works well, but I am not able to set the category to post in.

    var post = new Post();

    //since this is a struct, we can’t have a constructor that does this!
    //post.dateCreated = DateTime.Now;
    post.DateCreated = DateTime.Now;
    post.Title = “This is a title”;
    post.Body = “this is the body of the post. it could be html.”;
    post.Categories = new int[] { 1,9 }; // no matter what I put in here, each post goes to category 1 (default I guess)
    post.Tags = new string [] {“test”, “test2”};

    //create the post!
    wrapper.NewPost(post, true);

  5. IAM avatar
    IAM

    Add category and edit post is not working

  6. Borisov avatar
    Borisov

    Hello Alex,

    As the previous comment states, the add new category function is not working and it’s throwing the following error:
    [500] Sorry, the new category failed.

    The question is: IS there any way to fix this and if so, how?

    Thank you for your great work!

    Regards,
    Borisov

  7. James avatar

    Hello,

    I am trying to add new category and the function throws 500 error. Is there any fix?

  8. shan avatar
    shan

    Hi Alex,

    I am getting and error when using GetRecentPosts method in WordPressWrapper. The error says “Reference to undeclared entity ‘raquo’. Line 9, position 78.”

    Can you please tell, what is causing this issue.

    Code for you reference : error occurred in line 3.

    1. WordPressWrapper wp = new WordPressWrapper(“http://localhost/wordpress/”, “admin”, “admin”);
    2. var posts = wp.GetRecentPosts(2);
    3. MessageBox.Show(posts.Count.ToString());

    thanks.

    Regards.

  9. shan avatar
    shan

    error occurred in line 2 not 3.

  10. Dilip avatar

    Hey I am unable to use this dll and wrapper for wordpress.com site…I want to publish to dilipm.wordpress.com
    Unable to do it….getting such errors
    [401] Sorry, you do not have access to user data on this site. (when accessing wp.GetUserInfo(); )
    [401] Sorry, you must be able to edit posts on this site in order to view categories.(when accessing wp.GetCategories();)…
    Now if this is not possible with wordpress.com sites..how can android app like BlogAway Lite able to do publish posts to my blog!!!!?

  11. Nitin avatar
    Nitin

    link to codeplex is not working. can you please share the link from where i can download the DLLS.

Leave a Reply

Your email address will not be published. Required fields are marked *