This document discusses the two main APIs used by WordPress - XML-RPC and AtomPub. XML-RPC uses XML over HTTP POST to transmit basic data types and allows for functions like metaWeblog.getPost. AtomPub uses HTTP methods to interact with Atom feeds and individual posts and comments. It provides a standardized way to interact with content repositories. The document also outlines tools for working with the WordPress APIs like the iPhone app and XML-RPC libraries for developers.
3. XML-RPC Basics
• XML over HTTP POST
• Basic data types (int, bool, string, double,
dateTime.iso8601, base64) combined with
structs and arrays
• Supports pipelining with system.multicall
• Authentication generally in request body
• Spec - xmlrpc.com/spec
5. XML-RPC Response
<?xml version=quot;1.0quot;?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member><name>postid</name><value><string>1</string></value></member>
to
<member><name>description</name><value><string>Welcome
WordPress. This is your first post. Edit or delete it, then start
blogging!</string></value></member>
<member><name>title</name><value><string>Hello world!</string><value></
member>
...
</struct>
</value>
</param>
</params>
</methodResponse>
6. AtomPub Basics
• XML over HTTP (GET, POST, PUT, DELETE)
• Shared base with Atom feeds
• Collections (Posts, Comments, Media),
Entries (Individual posts and comments)
• Great intro from Joe Gregorio - http://
bitworking.org/news/343/intro-to-atompub-
on-youtube
• http://tools.ietf.org/html/rfc5023
8. AtomPub Response
<?xml version=quot;1.0quot; encoding=quot;utf-8quot;?>
<entry xmlns=quot;http://www.w3.org/2005/Atomquot;
xmlns:app=quot;http://www.w3.org/2007/appquot; xml:lang=quot;enquot;>
<id>http://localhost/~joseph/wp/trunk/?p=1</id>
<title type=quot;textquot;>Hello world!</title>
<updated>2008-08-08T01:01:03Z</updated>
<published>2008-08-08T01:01:03Z</published>
<app:edited>2008-08-08T01:01:03Z</app:edited>
<app:control>
<app:draft>no</app:draft>
</app:control>
<author><name>admin</name></author>
<link href=quot;http://localhost/~joseph/wp/trunk/?p=1quot; />
<content type=quot;textquot;>Welcome to WordPress. This is your first post. Edit or delete
it, then start blogging!</content>
<link rel=quot;editquot; href=quot;http://localhost/~joseph/wp/trunk/wp-app.php/post/1quot; />
<category scheme=quot;http://localhost/~joseph/wp/trunkquot; term=quot;Uncategorizedquot; />
<summary type=quot;textquot;>Welcome to WordPress. This is your first post. Edit or delete
it, then start blogging!</summary>
</entry>
24. XML-RPC for WP Devs
• Add your own XML-RPC methods
add_filter( 'xmlrpc_methods', 'joseph_attach_xmlrpc_methods' );
function joseph_attach_xmlrpc_methods( $methods ) {
$methods['joseph.hello'] = 'joseph_xmlrpc_hello';
return $methods;
}
25. XML-RPC for WP Devs
• Add your own XML-RPC methods
function joseph_xmlrpc_hello( $args ) {
if ( empty( $args[0] ) )
return new IXR_Error( 2000, __( 'No name was provided.' ) );
$salutation = quot;Hello {$args[0]}, nice to see you!quot;;
return $salutation;
}
27. bbPress XML-RPC
• Part of version 1.0 (when it comes out)
• Pingback support
• bbPress Live - WordPress Plugin
• BuddyPress forums
28. Going Forward
• More data/features exposed via XML-RPC &
AtomPub
• Everything wp-admin can do?
• Likely a WordPress namespace for new
AtomPub features