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

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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 – https://core.trac.www.ads-software.com/ – for specific items is good as well.

    Thread Starter dklon

    (@dklon)

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

    https://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:

    https://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.

    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!

    Thread Starter dklon

    (@dklon)

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

    The plugin.php modification (https://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.

    Thread Starter dklon

    (@dklon)

    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?

    Thread Starter dklon

    (@dklon)

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

    https://core.trac.www.ads-software.com/ticket/14236

    TBotNik

    (@tbotnik)

    dklon,

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

    Wrote it up at:

    https://www.ads-software.com/support/topic/xml-rpc-question?replies=11

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

    https://pastebin.com/pSYxsB5B

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

    Thanks!

    TBNK

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘XML-RPC API Extensions’ is closed to new replies.