Support » Developing with WordPress » What is XML-RPC good for?

  • Hiya forumers,

    I was wondering if anyone could clarify a few things for me
    about XML-RPC?

    XML-RPC is used by blogging client software to automatically post to blogs.

    My understanding is that XML-RPC is a container protocol for sending requests from a client application to the WordPress server. Inside of XML-RPC are calls made using the Blogger/Metaweblogs/MoveableType APIs.

    All of the examples I’ve seen of using XML-RPC seem to be focused around posts and categories. So far I’ve seen nothing to indicate it can be used for more advanced things than posting to a blog. Is this true?

    I saw something somewhere that made it seem like I might be able to execute any PHP code through the XML-RPC interface? (this would be excellent)

    Long story short, I’m trying to find out if I can use XML-RPC to get meta-information from all the comments on my blog, and then automatically shut down comments on blog posts that are older than a certain date and don’t have any comments.

    Using a plugin isn’t an option because I’m using WordPress Multiuser.

    Thanks in advanced, I hope this post gets more than just crickets chirping. 🙂

Viewing 14 replies - 1 through 14 (of 14 total)
  • WordPress 2.2 release notes

    “A new set of WordPress-specific XML-RPC APIs that allow for editing pages, setting categories, and much more.”

    Are these APIs documented anywhere?

    Couple links, in case you haven’t found ’em yet 🙂

    which leads to

    Just found the latest documentation of MT XML-RPC.

    All existing links to it were broken because Six Apart did a reorg.

    One weird thing… I can’t get a list of all post ids via XML-RPC? I would have thought that would be a common command.

    It doesn’t look like there’s much functionality in XML-RPC when it comes to comments. There is the mt_allow_comments field on posts that I should be able to turn on/off via XML-RPC, but there is no way to find out information about the number of comments on posts.

    I think what I’ll do is use the WXR export file as an input, parse it for comment information, and then use XML-RPC to twittle the comments allowed bit automatically.

    This is what I get running mt.supportedMethods

    $VAR1 = [

    and here are some samples of the info I can retrieve about a post

                'permaLink' => ' st-blog-2/',
                'wp_password' => '',
                'userid' => '190902',
                'mt_allow_pings' => '0',
                'mt_excerpt' => 'POST EXCERPT DISPLAYS INSTEAD OF POST',
                'wp_author_display_name' => 'engtech',
                'dateCreated' => '20060911T00:52:20',
                'link' => ' og-2/',
                'wp_slug' => 'this-is-a-test-blog-2',
                'mt_allow_comments' => '0',
                'categories' => [
                                'This is a really really really long category name',
                                'Child C',
                                'Category w/ Description'
                'description' => 'Hi there, welcome to <a href="http://engtech.wordp">//engtech</a>\'s little corner of the Internet for testing out themes on before switching them to my blog.
    <a href="">Jump directly t o the HTML test.</a>
    Comments are off for this posts, but it does have comments and should display th em.
    This post has an excerpt.',
                'postid' => '4',
                'wp_author_id' => '190902',
                'title' => 'Comments off, excerpt test.',
                'mt_text_more' => ''
                'permaLink' => '' ,
                'wp_password' => '',
                'userid' => '190902',
                'mt_allow_pings' => '0',
                'mt_excerpt' => '',
                'wp_author_display_name' => 'engtech',
                'dateCreated' => '20050911T03:46:43',
                'link' => '',
                'wp_slug' => 'old-post-3',
                'mt_allow_comments' => '0',
                'categories' => [
                'description' => 'Creating post archive',
                'postid' => '10',
                'wp_author_id' => '190902',
                'title' => 'Old Post #3',
                'mt_text_more' => ''

    There’s some documentation of what all of the non-WP specific API calls do here:

    Weird. Whenever I try to use metaWeblog.editPost and just set the mt_allow_comments field I get an error.

    my $call = $self->{ server }->call(
            $self->{ username },
            $self->{ password },
               mt_allow_comments => 1
            1 # 1 - publish
    set_mt_allow_comments: Sorry, your entry could not
     be edited. Something wrong happened.
    at line 37

    I’m hitting a bug and it won’t let me use a metaweblogs.editPost call.

    Looking at the xmlrpc.php source code:

    It’s dying with the oh-so-helpful “Something wrong happened” error.

    1241 $result = wp_update_post($newpost);
    1242 if (!$result) {
    1243 return new IXR_Error(500, __(‘Sorry, your entry could not be edited. Something wrong happened.’));
    1244 }

    I’ve tried a couple of different pre-wrapped APIs for using MetaWeblogs or MovableType RPC. It seems broken if all you’re trying to do is flip the comment bit.

    If you are using the metaWeblog.editPost method it won’t edit the post unless the description field is set. This prevents a lot of cool tricks like writing scripts to do things like turn off comments on all posts older than 30 days.

    What SHOULD happen is if the description isn’t set by the metaWeblog.editPost arguments then it will just use the existing description. editPost can be used for a lot more than just editing posts — it can be used for tweaking any of the settings on a blog.

    WOW. If you try to take the getRecentPosts response and pass it unmodified into metaWeblog.editPosts it gets REALLY screwed up because of time zones. Which breaks your URLs.

    < <link></link&gt;

    > <link></link&gt;
    < <wp:post_date>2005-09-11 03:46:21</wp:post_date>

    > <wp:post_date>2005-09-10 23:46:21</wp:post_date>
    < <link></link&gt;

    > <link></link&gt;
    < <wp:post_date>2005-09-11 03:46:43</wp:post_date>

    > <wp:post_date>2005-09-10 23:46:43</wp:post_date>

    solution is not to pass the dateCreated field.

    base64 characters can cause problems as well, but that is more of an issue with XMLRPC::Lite in Perl.

    Hi engtech, thanks for these posts and links! I’ve had the feeling that XML RPC with wordpress is under-documented for some time now. Will give it a try again …

    I’m still having huge headaches with base64 characters killing XMLRPC::Lite in perl. I’ve tried out XMLRPC::PurePerl and XML::RPC instead, but both of those packages have even more issues than XMLRPC::Lite.

    I found one hack on the net for XMLRPC::Lite that “kinda” got it to work, but it ended up corrupting a lot of the Base64 characters on my blog into something weird.

    so passing datecreated is off limits…. any fix for this yet?

    I need help passing categories on the mw_newPost


Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘What is XML-RPC good for?’ is closed to new replies.