WordPress.org

Ready to get started?Download WordPress

Forums

XML-RPC API Extensions (8 posts)

  1. dklon
    Member
    Posted 4 years ago #

    Hi everyone. I have been a longtime user of WordPress and also a developer. Recently I've been coding up an app that leverages the XML-RPC API for WordPress and found it somewhat lacking.

    So I did some extending to it, but before I go off and finish more of it, I was wondering where or if extending the WordPress XML-RPC API is welcomed, or if I should keep this to myself.

    The documentation is great for writing plugins and such, but there wasn't anything formally written for this particular area. I believe someone from the dev team awhile back mentioned that XML-RPC is kinda neglected. But I would like to contribute some of these new API calls if they are wanted.

  2. Joseph Scott
    Member
    Posted 4 years ago #

    Is your code available some where for people to take a look at?

    You can also email the wp-xmlrpc email list with this info, that's a good target audience.

    And of course a ticket - http://core.trac.wordpress.org/ - for specific items is good as well.

  3. dklon
    Member
    Posted 4 years ago #

    Here are some of the functions that I've written in xmlrpc.php:

    http://wordpress.pastebin.com/N4eDYfeN

    The API calls come out as:

    • wp.getPluginList
    • wp.isPluginActive
    • wp.getActivePlugins
    • wp.activatePlugin

    I've added two lines to the get_plugin_data() call in /wp-admin/includes/plugin.php for 1 more element in the return header:

    http://wordpress.pastebin.com/wqDu0N97

    These are just some of the plugin functions. I'll sign up for the wp-xmlrpc list as well. XML-RPC and SOAP services are something that I work on almost daily for my own projects so I thought it would be a good fit to try this out.

  4. Joseph Scott
    Member
    Posted 4 years ago #

    Plugin management via XML-RPC would be handy. I'd suggest a couple of changes. Stick with just one method, wp.getPluginList, and include the status of the plugin (active/not active) as one of the data fields that it returns.

    Now that I think about, you could generalize this a bit more by including filters as method parameters. Something like wp.getPluginList( blog_id, username, password, array( 'status' => 'active' ) ) that would return only active plugins. The wp.getComments method does something similar.

    Although we aren't making use of it I'd suggest keeping the blog_id parameter, we've talked about using it in the future.

    Definitely worth creating a ticket for this (there might be one already, best to search first) and put the patches up there for more feed back. Make sure to post the URL for the ticket here afterwards so that anyone coming across this later knows where to look.

    Thanks!

  5. dklon
    Member
    Posted 4 years ago #

    Okay, I'll start putting this together in Trac as a ticket with patch.

    The plugin.php modification (http://wordpress.pastebin.com/wqDu0N97) should satisfy the condition for returning the data with the extra "Active" element in the array when calling wp.getPluginList, although I wasn't sure if making it bool instead of text like the others violated some coding rule. But every XML-RPC library seems to make the conversion to and from in the background easily.

    I've got a ton more extensions to the API that I didn't post since I wasn't sure if they would be welcomed. These were the smallest to post up here. Plugin management was just one area I had to tackle for this app.

  6. dklon
    Member
    Posted 4 years ago #

    Hmm. I've tried logging into Trac to put the diffs up on a ticket, but it doesn't seem to want to accept my username and password from here. Is there something else I'm missing?

  7. dklon
    Member
    Posted 4 years ago #

    Okay, here is the Trac ticket for this particular set of enhancements for the XML-RPC API:

    https://core.trac.wordpress.org/ticket/14236

  8. TBotNik
    Member
    Posted 3 years ago #

    dklon,

    Wondering if you can look at and help me with a problem?

    Wrote it up at:

    http://wordpress.org/support/topic/xml-rpc-question?replies=11

    Also have the code, where I am at on pastebin at:

    http://pastebin.com/pSYxsB5B

    It's either my hook or method that is wrong, I think.

    Thanks!

    TBNK

Topic Closed

This topic has been closed to new replies.

About this Topic