metaweblog.php

This file implements the MetaWeblog API for posting to your blog via XML-RPC.

Summary
This file implements the MetaWeblog API for posting to your blog via XML-RPC.
The MetaWeblog API is a blogging interface that includes support for various types of blog metadata.
When configuring your blogging client to use the MetaWeblog API with LnBlog, give the URL of your LnBlog/metaweblog.php file as the address to handle the requests.
LnBlog’s implementation conservatively extends the MetaWeblog API.
Creates a new post.
Change an existing post.
Get information for an existing post
Gets a list of categories associated with a given blog.
Gets a list of the most recent posts to a blog.

Overview

The MetaWeblog API is a blogging interface that includes support for various types of blog metadata.  This is in contrast to the Blogger 1 API, which included basic support for adding and editing entry text, but had no notion of subjects, categories, and the like.  It was also heavily biased in favor of Blogger’s implementation.  The MetaWeblog API is intended as a more general API to remedy this situation.

Like the Blogger API, MetaWeblog functions by making XML-RPC calls.  Most of the data used by the API calls takes the form of XML-RPC structs.  The API contains the base methods given below.  For full details, please consult the MetaWeblog API specification at http://www.xmlrpc.com/metaWeblogApi.

metaWeblog.newPostCreates a new post.
metaWeblog.editPostEdits an existing post.
metaWeblog.gePostReturns a representation of an existing post.
metaWeblog.newMediaObjectCreates a new image, video file, etc. for the blog.
metaWeblog.getCategoriesReturns the categories known to the blog.
metaWeblog.getRecentPostsReturns a list of the most recently made posts.

Configuration

When configuring your blogging client to use the MetaWeblog API with LnBlog, give the URL of your LnBlog/metaweblog.php file as the address to handle the requests.  You can use your normal LnBlog username and password as your login.  For the blog ID, give the root-relative path to your blog.  If you look on the index.php admin page, this is simply the text that shows up in the drop-down for upgrading your blog.

When editing posts via the API, the post ID is simply the URL of the directory in which the post is stored, with the protocol and domain name removed.  So, if your post is at

http://www.mysite.com/myblog/2006/05/04/03_2100/

then the post ID would be

myblog/2006/05/04/03_2100/

API Extensions

LnBlog’s implementation conservatively extends the MetaWeblog API.  In other words, the implementation remains compatible with the standard, but adds a few features that clients may, at their option, choose to use.

The newMediaObject method has been extended with an optional struct field called ‘entryid’.  This field takes the same entry ID used by the getPost and editPost methods.  If this field is specified, then the media object will be added to that particular entry rather than to the base weblog.  Note that this extension only makes sense for blog systems which can segregate files on a per-entry basis, like LnBlog.  Systems that do not have such a concept should ignore this field.

Summary
Creates a new post.
Change an existing post.
Get information for an existing post
Gets a list of categories associated with a given blog.
Gets a list of the most recent posts to a blog.

Functions

metaWeblog. newPost

Creates a new post.

Parameters

blogid(string)Identifier for the blog.
username(string)Username to log in as.
password(string)The password to log in with.
content(struct)A struct containing the post information.  The struct members are, in general, the same as in the RSS 2.0 items.
publish(boolean)Whether or not to immediately publish the entry.  The parameter is not currently used by LnBlog.

Returns

A string representation of the unique ID of this post.

metaWeblog. editPost

Change an existing post.

Parameters

postid(string)Identifier for the post.
username(string)Username to log in as.
password(string)The password to log in with.
content(struct)A struct containing the new post information.  The struct members are, in general, the same as in the RSS 2.0 items.
publish(boolean)Whether or not to immediately publish the entry.  The parameter is not currently used by LnBlog.

Returns

True on success, raises a fault on failure.

metaWeblog. getPost

Get information for an existing post

Parameters

postid(string)Identifier for the post.
username(string)Username to log in as.
password(string)The password to log in with.

Returns

A struct representing the post.  As in the aruguments to metaWeblog.newPost, the struct contains elements corresponding to those in RSS 2.0 item elements.

metaWeblog. getCategories

Gets a list of categories associated with a given blog.

Parameters

blogid(string)Identifier for the blog.
username(string)Username to log in as.
password(string)The password to log in with.

Returns

A struct containing one struct for each category.  The category structs must contain description, htmlURL, and rssURL elements.  Note that LnBlog currently does not have RSS URLs for categories.

metaWeblog. getRecentPosts

Gets a list of the most recent posts to a blog.

Parameters

blogid(string)Identifier for the blog.
username(string)Username to log in as.
password(string)The password to log in with.
numberOfPosts(int)The number of posts to return.

Returns

An array of structs.  The struct contents are as in the return value of the metaWeblog.getPost method.

The page for the main administration menu.
Creates a new post.
Get information for an existing post