Dave Rolsky > WP-API-0.01 > WP::API

Download:
WP-API-0.01.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

WP::API - An interface to the WordPress XML-RPC API

VERSION ^

version 0.01

SYNOPSIS ^

  my $api = WP::API->new(
      username         => 'testuser',
      password         => 'testpass',
      proxy            => 'http://example.com/xmlrpc.php',
      server_time_zone => 'UTC',
  );

  my $post = $api->post()->create(
      post_title    => 'Foo',
      post_date_gmt => $dt,
      post_content  => 'This is the body',
      post_author   => 42,
  );

  print $post->post_modified_gmt()->date();

  my $other_post = $api->post()->new( post_id => 99 );
  print $other_post->post_title();

DESCRIPTION ^

This module is very new and only covers a small portion of the WordPress API. Patches to increase coverage are welcome.

This module provides a Perl interface to the WordPress XML-RPC API. See http://codex.wordpress.org/XML-RPC_WordPress_API for API details.

Generally speaking, classes in this module follow the same naming convention as WordPress itself when it comes to object attributes. However, the actual API methods have been made more Perlish, so we have $api->post()->create() instead of $api->newPost().

METHODS ^

This module is the main entry point for creating objects from WordPress data. You should not instantiate any other class directly.

WP::API->new(...)

This creates a new API object. It accepts the following parameters:

$api->post()

This returns a shim for the WP::API::Post class. You can call any class method that class provides, such as new() or create, on this shim.

$api->media()

This returns a shim for the WP::API::Media class. You can call any class method that class provides, such as new() or create, on this shim.

$api->call(...)

Calls an XML-RPC method on the server. The first argument should be an XML-RPC method name like 'wp.editPost' and the remaining parameters should be the parameters for the method.

This method automatically prepends the blog_id, username, and password to calls as needed.

If the call fails for some reason, this method throws an error. Otherwise it returns the raw data structure returned by WordPress.

AUTHOR ^

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2013 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
syntax highlighting: