Movable Type User Manual: PROGRAMMATIC INTERFACES
PROGRAMMATIC INTERFACESXML-RPC API
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 aregetTemplate and setTemplate, due to the differences between Blogger's
template system and Movable Type's template system.
English: http://jaimbizzle.sourceforge.net/mt/do
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:
- blogger.newPost
Description: Creates a new post, and optionally publishes it.Parameters: String appkey, String blogid, String username, String
password, String content, boolean publishReturn value: on success, String postid of new post; on failure, fault
- blogger.editPost
Description: Updates the information about an existing post.Parameters: String appkey, String postid, String username, String
password, String content, boolean publishReturn value: on success, boolean true value; on failure, fault
- blogger.deletePost
Description: Deletes a post.Parameters: String appkey, String postid, String username, String
password, boolean publishReturn value: on success, boolean true value; on failure, fault
- blogger.getRecentPosts
Description: Returns a list of the most recent posts in the system.Parameters: String appkey, String blogid, String username, String
password, int numberOfPostsReturn value: on success, array of structs containing ISO.8601
dateCreated, String userid, String postid, String content; on
failure, faultNotes: dateCreated is in the timezone of the weblog blogid
- blogger.getUsersBlogs
Description: Returns a list of weblogs to which an author has posting
privileges.Parameters: String appkey, String username, String password
Return value: on success, array of structs containing String url,
String blogid, String blogName; on failure, fault - blogger.getUserInfo
Description: Returns information about an author in the system.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, faultNotes: firstname is the Movable Type username up to the first space
character, and lastname is the username after the first space character. - metaWeblog.newPost
Description: Creates a new post, and optionally publishes it.Parameters: String blogid, String username, String password,
struct content, boolean publishReturn value: on success, String postid of new post; on failure, fault
Notes: the struct content can contain the following standard keys:
title, for the title of the entry; description, for the body of
the entry; and dateCreated, to set the created-on date of the entry.
In addition, Movable Type's implementation allows you to pass in values for
five other keys: int mt_allow_comments, the value for the
allow_comments field; int mt_allow_pings, the value for the
allow_pings field; String mt_convert_breaks, the value for the
convert_breaks field; String mt_text_more, the value for the additional
entry text; String mt_excerpt, the value for the excerpt field;
String mt_keywords, the value for the keywords field; and array
mt_tb_ping_urls, the list of TrackBack ping URLs for this entry.
If specified, dateCreated should be in ISO.8601 format. - metaWeblog.editPost
Description: Updates information about an existing post.Parameters: String postid, String username, String password,
struct content, boolean publishReturn value: on success, boolean true value; on failure, fault
Notes: the struct content can contain the following standard keys:
title, for the title of the entry; description, for the body of
the entry; and dateCreated, to set the created-on date of the entry.
In addition, Movable Type's implementation allows you to pass in values for
five other keys: int mt_allow_comments, the value for the
allow_comments field; int mt_allow_pings, the value for the
allow_pings field; String mt_convert_breaks, the value for the
convert_breaks field; String mt_text_more, the value for the additional
entry text; String mt_excerpt, the value for the excerpt field;
String mt_keywords, the value for the keywords field; and array
mt_tb_ping_urls, the list of TrackBack ping URLs for this entry.
If specified, dateCreated should be in ISO.8601 format. - metaWeblog.getPost
Description: Returns information about a specific post.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, String mt_excerpt, String
mt_text_more, int mt_allow_comments, int mt_allow_pings,
String mt_convert_breaks, String mt_keywords; on failure, faultNotes: link and permaLink are both the URL pointing to the archived
post. The fields prefixed with mt_ are Movable Type extensions to the
metaWeblog.getPost API. - metaWeblog.getRecentPosts
Description: Returns a list of the most recent posts in the system.Parameters: String blogid, String username, String password,
int numberOfPostsReturn value: on success, array of structs containing ISO.8601
dateCreated, String userid, String postid, String description,
String title, String link, String permaLink, String mt_excerpt,
String mt_text_more, int mt_allow_comments, int
mt_allow_pings, String mt_convert_breaks, String mt_keywords;
on failure, faultNotes: dateCreated is in the timezone of the weblog blogid; link
and permaLink are the URL pointing to the archived post - metaWeblog.newMediaObject
Description: Uploads a file to your webserver.Parameters: String blogid, String username, String password,
struct fileReturn value: URL to the uploaded file.
Notes: the struct file should contain two keys: base64 bits
(the base64-encoded contents of the file) and String name (the name
of the file). The type key (media type of the file) is currently
ignored. - mt.getRecentPostTitles
Description: Returns a bandwidth-friendly list of the most recent posts in the system.Parameters: String blogid, String username, String password,
int numberOfPostsReturn value: on success, array of structs containing ISO.8601
dateCreated, String userid, String postid, String title; on
failure, faultNotes: dateCreated is in the timezone of the weblog blogid
- mt.getCategoryList
Description: Returns a list of all categories defined in the weblog.Parameters: String blogid, String username, String password
Return value: on success, an array of structs containing String
categoryId and String categoryName; on failure, fault. - mt.getPostCategories
Description: Returns a list of all categories to which the post is
assigned.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. - mt.setPostCategories
Description: Sets the categories for a post.Parameters: String postid, String username, String password,
array categoriesReturn 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. - mt.supportedMethods
Description: Retrieve information about the XML-RPC methods supported by
the server.Parameters: none
Return value: an array of method names supported by the server.
- mt.supportedTextFilters
Description: Retrieve information about the text formatting plugins
supported by the server.Parameters: none
Return value: an array of structs containing String key and String
label. key is the unique string identifying a text formatting plugin,
and label is the readable description to be displayed to a user. key
is the value that should be passed in the mt_convert_breaks parameter
to newPost and editPost. - mt.getTrackbackPings
Description: Retrieve the list of TrackBack pings posted to a particular
entry. This could be used to programmatically retrieve the list of pings
for a particular entry, then iterate through each of those pings doing the
same, until one has built up a graph of the web of entries referencing one
another on a particular topic.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). - mt.publishPost
Description: Publish (rebuild) all of the static files related to an
entry from your weblog. Equivalent to saving an entry in the system (but
without the ping).Parameters: String postid, String username, String password
Return value: on success, boolean true value; on failure, fault
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 weblog, follow these instructions:
Download BlogBuddy from http://blogbuddy.sourceforge.net/. Unpack the archive,
and install the application.
Open the BlogBuddy application.
Select General Settings from the Settings menu. On the General tab,
enter your Movable Type username in UserName, and your password in
Password.
In the Remote Host tab, enter the name of the host where your version of
Movable Type is installed into Host name, and the path to mt-xmlrpc.cgi
into Endpoint. For example, if mt-xmlrpc.cgi is located at
http://www.example.com/bar/mt-xmlrpc.cgi, you should enter www.example.com into
Host name, and /bar/mt-xmlrpc.cgi into Endpoint. If your webserver
runs on a port other than 80, you should also change the port setting.
In the Blogs tab, click the Update blogs button; BlogBuddy will contact
Movable Type on your webserver, and ask it for a list of weblogs which you have
access to (using getUsersBlogs, above).
You can now post to your Movable Typeweblog(s)using BlogBuddy's posting
interface.
Sending a TrackBack Ping
http://www.sixapart.com/pronet/docs/trac
TrackBack uses a REST model,
where requests are made through standard HTTP calls.
To send a TrackBack ping,
the client makes a standard HTTP request to the server,
and receives a response in a simple XML format (see below for more details).
In the TrackBack system,
the URL that receives TrackBack pings is the TrackBack Ping URL.
A typical TrackBack Ping URL looks like http://www.example.com/trackback/5
where 5
is the TrackBack ID.
Server implementations can use whatever format makes sense for the
TrackBack Ping URL; client implementations should not depend on a
particular format.
To send a ping,
the client sends an HTTP POST request to the TrackBack Ping URL.
The client MUST send a Content-Type HTTP header,
with the content type set to application/x-www-form-urlencoded.
The client SHOULD include the character encoding of the content being sent (title,
excerpt,
and weblog name) in the charset attribute of the Content-Type header.
For example,
a ping request might look like:
POST http://www.example.com/trackback/5
Content-Type: application/x-www-form-urlencoded; charset=utf-8
title=Foo+Bar&url=http://www.bar.com/&excerpt=My+Excerpt&blog_name=FooThe possible parameters in the request content are the following:
- title
- excerpt
- url
- blog_name
The title of the entry.
Optional.
An excerpt of the entry.
Optional.
The permalink for the entry. Like any permalink, this should point
as closely as possible to the actual entry on the HTML page, as it will
be used when linking to the entry in question.
Required. If a client neglects to send a url, the server MUST respond with an error message.
The name of the weblog to which the entry was posted.
Optional.
All of the fields provided MUST be in the character encoding specified in charset.
There are no length restrictions on the above fields inherent in the
TrackBack protocol, but server implementations are free to crop or
ignore any of the above fields.
In the event of a succesful ping, the server MUST return a response in the following format:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>0</error>
</response>In the event of an unsuccessful ping, the server MUST return an HTTP response in the following format:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>1</error>
<message>The error message</message>
</response><br /
