Movable Type features a full implementation of the Blogger XML-RPC API (where
applicable). The only two methods that are not supported by Movable Type are
getTemplate and setTemplate, due to the differences between Blogger's
template system and Movable Type's template system.
Movable Type also supports the metaWeblog XML-RPC API (also where applicable).
Finally, Movable Type also adds a couple of other methods of its own for manipulating the categories assigned to your entries.
Usage of any of these XML-RPC APIs
requires that your webserver have both LWP::UserAgent and SOAP::Lite
installed; if yours does not, the Installation Instructions can tell you how
to install them.
Following are the XML-RPC methods supported by Movable Type:
Parameters: String appkey, String blogid, String username, String password, String content, boolean publish
Return value: on success, String postid of new post; on failure, fault
Parameters: String appkey, String postid, String username, String password, String content, boolean publish
Return value: on success, boolean true value; on failure, fault
Parameters: String appkey, String postid, String username, String password, boolean publish
Return value: on success, boolean true value; on failure, fault
Parameters: String appkey, String blogid, String username, String password, int numberOfPosts
Return value: on success, array of structs containing ISO.8601 dateCreated, String userid, String postid, String content; on failure, fault
Notes: dateCreated is in the timezone of the blog blogid
Parameters: String appkey, String username, String password
Return value: on success, array of structs containing String url, String blogid, String blogName; on failure, fault
Parameters: String appkey, String username, String password
Return value: on success, struct containing String userid, String firstname, String lastname, String nickname, String email, String url; on failure, fault
Notes: firstname is the Movable Type username up to the first space character, and lastname is the username after the first space character.
Parameters: String blogid, String username, String password, struct content, boolean publish
Return value: on success, String postid of new post; on failure, fault
Notes: the struct content can contain the following two keys: title, for the title of the entry; and description, for the body of the entry. Any other keys will be ignored.
Parameters: String postid, String username, String password, struct content, boolean publish
Return value: on success, boolean true value; on failure, fault
Notes: the struct content can contain the following two keys: title, for the title of the post; and description, for the body of the post. Any other keys will be ignored.
Parameters: String postid, String username, String password
Return value: on success, struct containing String userid, ISO.8601 dateCreated, String postid, String description, String title, String link, String permaLink; on failure, fault
Notes: link and permaLink are both the URL pointing to the archived post
Parameters: String blogid, String username, String password, int numberOfPosts
Return value: on success, array of structs containing ISO.8601 dateCreated, String userid, String postid, String description, String title, String link, String permaLink; on failure, fault
Notes: dateCreated is in the timezone of the blog blogid; link and permaLink are the URL pointing to the archived post
Parameters: String blogid, String username, String password
Return value: on success, an array of structs containing String categoryId and String categoryName; on failure, fault.
Parameters: String postid, String username, String password
Return value: on success, an array of structs containing String categoryName, String categoryId, and boolean isPrimary; on failure, fault.
Notes: isPrimary denotes whether a category is the post's primary category.
Parameters: String postid, String username, String password, array categories
Return value: on success, boolean true value; on failure, fault
Notes: the array categories is an array of structs containing String categoryId and boolean isPrimary. Using isPrimary to set the primary category is optional--in the absence of this flag, the first struct in the array will be assigned the primary category for the post.
Parameters: none
Return value: an array of method names supported by the server.
Parameters: String postid
Return value: an array of structs containing String pingTitle (the title of the entry sent in the ping), String pingURL (the URL of the entry), and String pingIP (the IP address of the host that sent the ping).
NOTE: the value of appkey is ignored by Movable Type in all of the
Blogger XML-RPC methods.
You can use Movable Type's XML-RPC implementation with existing tools like w.bloggar, BlogApp, BlogLet, BlogBuddy, Jericho, etc. For example, to set up BlogBuddy to post to your Movable Type blog, follow these instructions:
blog(s) using BlogBuddy's posting
interface.
The Movable Type code is written in an object-oriented style and contains a well-documented Perl API that you can use in your own Perl programs. The documentation itself is in POD format and is contained within the .pm files. You can read this documentation from the shell using the perldoc command. For example:
% cd <movable type directory>/lib % perldoc MT
Movable Type's plugin framework makes it easy to add new tags to the system. In the future, more callback functionality will be added.
Plugin files are Perl scripts placed in a special directory; when Movable Type is initalized, it loads all of the plugins, which can modify the Movable Type code and system at runtime.
Your plugins directory should be placed in the same directory as mt.cgi.
To create that directory, connect to your FTP server, and open the directory where you installed Movable Type. Create a new directory called plugins.
Here is a sample plugin that you can use to test whether your plugins directory is set up properly.
use MT::Template::Context;
MT::Template::Context->add_tag(ServerUptime => sub { `uptime` });
1;
Uptime: <$MTServerUptime$>
This is just a very simple example of a new tag that you can add. The plugin framework is not limited to adding tags that call system commands.
Here's an example of a plugin that creates a container tag:
MT::Template::Context->add_container_tag(Loop => sub {
my $ctx = shift;
my $res = '';
my $builder = $ctx->stash('builder');
my $tokens = $ctx->stash('tokens');
for my $i (1..5) {
$ctx->stash('i_value', $i);
defined(my $out = $builder->build($ctx, $tokens))
or return $ctx->error($ctx->errstr);
$res .= $out;
}
$res;
});
MT::Template::Context->add_tag(LoopIValue => sub {
my $ctx = shift;
$ctx->stash('i_value');
});
It can be used like this in a template:
<MTLoop> The value of I is: <$MTLoopIValue$> </MTLoop>
And it will display: