This sounds like an interesting way to enhance WP behaviours. And your plugin is pretty good example of that.<br><br>Thanks Eric for your insightful answer.<br><br>Nicolas<br><br><br><br><div class="gmail_quote">On Tue, Aug 31, 2010 at 5:22 PM, Eric Mann <span dir="ltr"><<a href="mailto:eric@eamann.com">eric@eamann.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">There isn't a single resource for API documentation because XML-RPC supports<br>
multiple APIs. Here are a few references for you:<br>
<br>
- WordPress API: <a href="http://codex.wordpress.org/XML-RPC_wp" target="_blank">http://codex.wordpress.org/XML-RPC_wp</a><br>
- Blogger API: <a href="http://www.blogger.com/developers/api/1_docs/" target="_blank">http://www.blogger.com/developers/api/1_docs/</a><br>
- MetaWeblog API: <a href="http://www.xmlrpc.com/metaWeblogApi" target="_blank">http://www.xmlrpc.com/metaWeblogApi</a><br>
- Movable Type API: <a href="http://www.sixapart.com/developers/xmlrpc/movable_type_api/" target="_blank">http://www.sixapart.com/developers/xmlrpc/movable_type_api/</a><br>
<br>
It is possible to add custom RPC methods through plug-ins. It's fairly easy to<br>
do, and you can extend custom plug-in functionality this way (you can use<br>
WordPress as any kind of SOAP or REST service if you have the right kind of<br>
extensibility built-in).<br>
<br>
To add your own function, you'll need to do the following:<br>
<br>
function xml_add_method( $methods ) {<br>
$methods['myNamespace.myMethod'] = 'my_method_name';<br>
return $methods;<br>
}<br>
add_filter( 'xmlrpc_methods', 'xml_add_method');<br>
<br>
The above code will add a new XML-RPC method to core. Any external service can<br>
now post a request to <a href="http://blogname.url/xmlrpc.php" target="_blank">http://blogname.url/xmlrpc.php</a> and call<br>
'myNamespace.myMethod'. Any arguments passed to that method call will be passed<br>
directly into a PHP function called 'my_method_name'. So you'll also need the<br>
following:<br>
<br>
function my_method_name( $args ) {<br>
global $wpdb; // If you want to use this object to load, store, or manipulate<br>
data<br>
<br>
$args = wp_parse_args( $args );<br>
extract( $args, EXTR_SKIP );<br>
<br>
...<br>
}<br>
<br>
Once your arguments are extracted and stored in variables, you can do whatever<br>
you want with them. If you want an example of how I'm using this for plug-in<br>
callbacks, I suggest looking through the code to my Elliot Server project on<br>
Google Code: <a href="http://code.google.com/p/elliot-server/" target="_blank">http://code.google.com/p/elliot-server/</a>. This system adds an entry<br>
point that remote plug-ins can post error messages to so a developer can follow<br>
up. It's a work in progress, though, so expect it to gradually change over<br>
time.<br>
<br>
~Eric<br>
<div><div></div><div class="h5"> <br>
<br>
On August 31, 2010 at 2:42 PM nico <<a href="mailto:nsebban@gmail.com">nsebban@gmail.com</a>> wrote:<br>
<br>
<br>
> Hello,<br>
><br>
> I've been playing with the XMLRPC API, and I have a few unanswered questions :<br>
><br>
> --Is there a Codex page that lists every RPC method, with links to the<br>
> corresponding help page ?<br>
> I couldn't find any...I usually end up catenating the URL<br>
> <a href="http://codex.wordpress.org/XML-RPC/with" target="_blank">http://codex.wordpress.org/XML-RPC/with</a> the method name (ie.<br>
> <a href="http://codex.wordpress.org/XML-RPC/wp.getComments" target="_blank">http://codex.wordpress.org/XML-RPC/wp.getComments</a>), and it sometimes works.<br>
> I'll gladly create a codex account and set this page up, if it doesn't exist<br>
> already...I just wanted to be sure it's not redundant.<br>
><br>
> --Are there plans for new RPC methods in the near future ?<br>
> I realized that many of the WP3 new features (custom taxonomies, custom post<br>
> types) don't have corresponding RPC methods...are there plans to add these ?<br>
> Is the XMLRPC part of Wordpress still alive ?<br>
><br>
> --Is it possible adding custom RPC methods through plugins code ? Do you<br>
> recommend it ?<br>
> I noticed the "xmlrpc_methods" filter, that can be used to add custom RPC<br>
> methods programmatically in plugins. I think I read at some point that the<br>
> whole Wordpress "engine" is not started when dealing with XMLRPC requests...In<br>
> that context, would registering new methods through the filter and loading the<br>
> corresponding callbacks work ? And would you do it that way ?<br>
><br>
> Thank you for your answers.<br>
><br>
> Nicolas<br>
><br>
><br>
><br>
</div></div>_______________________________________________<br>
wp-xmlrpc mailing list<br>
<a href="mailto:wp-xmlrpc@lists.automattic.com">wp-xmlrpc@lists.automattic.com</a><br>
<a href="http://lists.automattic.com/mailman/listinfo/wp-xmlrpc" target="_blank">http://lists.automattic.com/mailman/listinfo/wp-xmlrpc</a><br>
</blockquote></div><br>