NAME

WordPress::API

DESCRIPTION

Management of wordpress api objects. Inherits WordPress::XMLRPC and all its methods

The basic scope of WordPress::API is to do all the oo magic There should be no cli here, if you want to access the cli scripts, see WordPress::CLI

By contrast. WordPress::XMLRPC deals with all the calls to the wordpress server. And WordPress::CLI, is about scripting via the command line to interact with wordpress objects, defined here.

These packages can be used to do some marvelous remote maintenance of WordPress blogs. What if you wanted to scan all posts by Author 'jim' and move them to a new sub category called 'jim', which may or may not already exist? You can do that with these packages.

WARNING

This is under development. As feedback comes in more work will be done.

WHAT YOU SHOULD INTERFACE WITH

The API objects,

WordPress::API::Post
WordPress::API::Page
WordPress::API::MediaObject

Will not be changing in interface. Everything else is use at your own risk.

METHODS

new()

arg is hashref

my $w = new WordPress::API({
   proxy => 'http://site.com/xmlrpc.php',
   username => 'jimmy',
   password => 'secret',
});

GETTING OBJECTS

The main idea of WodPress::API is to manage objects (pages, posts, etc) in wordpress. You could use all the objects by themselves, but this offers some convenience.

post()

Optional arg is id (number) Returns WordPress::API::Post object

if you pass an id, we attemp to load, if we cannot, dies

page()

Optional arg is id (number) Returns WordPress::API::Page object

if you pass an id, we attemp to load, if we cannot, dies

media()

Optional arg is abs path to media file, likely image or pdf, etc return WordPress::API::MediaObject object

category()

Optional argument is an id of the category that exists. Returns WordPress::API::Category object.

XMLRPC METHODS

All methods in WordPress::XMLRPC are available in this package. For creating, editing, and inspecting posts, pages, etc, You can use the provided object calls such as page(), post(), and media().

deletePage()

Arg is page id.

deletePost()

Arg is post id.

BLOG INFO

blog_id()

1 by default.

blog_name()

Get the blog name.

blog_url()

Get the blog url.

SYNOPSIS

use WordPress::API;

my $w = WordPress::API->new({
   proxy => 'http://site/xmlrpc.php', # or abs path for working on disk instead???
   username => 'jim',
   password => 'pazz',
})

my $post = $w->post(4)
$post->delete;

my $page = $w->page;

$page->title('great title here');
$page->description('great content');
$page->save;

my $media = $w->media('./image.jpg');
$media->save;

print "saved ./image/jpg to ". $media->url;

SEE ALSO

Date::Manip WordPress::API::Category - abstraction to a category WordPress::API::MediaObject - abstraction to a 'media object' WordPress::API::Page - abstraction to a 'page' WordPress::API::Post - abstraction to a 'post' WordPress::XMLRPC - base interaction with wordpress blog WordPress::CLI - scripts to interact with this package via the command line YAML

BUGS

Please contact the AUTHOR.

AUTHOR

Leo Charre leocharre at cpan dot org