This file includes all the XML-RPC server code for LnBlog. This encompasses both the Pingback implementation and the Blogger and MetaWeblog API implementations.
This section implements Pingback for LnBlog, as described by the Pingback specification at http://hixie.ch/specs/pingback/pingback.
Pingback is similar to Trackback in that it is a mechanism for one blog to notify another when the first blog links to it. However, Pingback uses XML-RPC to send pings rather than HTTP POSTs. Additionally, the Pingback enables auto-discovery of pingable resources using HTTP headers and HTML link elements, as opposed to the embedded RDF code used by Trackback.
The XML-RPC interface for Pingback consists of a single pingback.ping method which is used to send a ping. In addition, LnBlog implements the suggested pingback.extensions.getPingbacks method used to syndicate pingbacks.
This method receives a ping from a remote host. It maps the target URL to a blog object, validates the source URL, and stores the ping if appropriate.
sourceuri | The URI of the page doing the pinging. |
targeturi | The URI of the page being pinged. |
On success, the URL to the stored pingback.
Gets a list of pingbacks on a page.
url | The URL of the page in question. |
An array of URLs, one for each pingback registered for the target.
This section implements the Blogger 1.0 API for posting to your blog via XML-RPC.
Blogger 1.0 is an old (as blogging APIs go) and widely supported API for use with weblog clients. It allows you to add and edit blog posts as well as set and retreive certain information about your blog. Support for this API was added to LnBlog in version 0.7.0 beta 1.
The Blogger 1.0 API has six methods, listed below.
blogger.newPost | Create a new blog entry. |
blogger.editPost | Modify the contents of an existing entry. |
blogger.getUsersBlogs | Get the blogs for a particular user. |
blogger.getUserInfo | Get the user information for a particular user. |
blogger.getTemplate | Get the template used for the blog. |
blogger.setTemplate | Set the template used for the blog. |
It is important to note that the Blogger 1.0 API is not generic. That is, it was designed specifically to work with Blogger and not for use by every weblog system on the face of the Earth. As a result, not all the methods work in exactly the same way as with Blogger. In particular, the getTemplate and setTemplate are simply not applicable to the way LnBlog works, and so they are not implemented.
In addition, the newPost and editPost methods do not include any metadata, and therefore do not accomodate setting a subject or topics for the entry. To remedy this, LnBlog allows you to (optionally) start your post with subject and tag lines, as indicated in the sample post data below. |Subject: Hey, it's a subject! |Tags: General,Test |This is the body of the post. The above two lines will be |stripped out of the post body and converted into the subject |and tags for this post.
Lastly, it should be noted that the API does not include a concept of input mode, i.e. there is no facility to set HTML, BBCode, or simple text input. Therefore, LnBlog will assume that all posts made with API calls use the default markup mode for the current blog.
When configuring your blogging client to use Blogger 1.0 with LnBlog, give the URL of your LnBlog/xmlrpc.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 blogger 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/entries/2006/05/04/03_2100/ then the post ID would be |myblog/entries/2006/05/04/03_2100/ Note that, for blogs that are hosted on a subdomain, the subdomain leads the ID. So if your entry is located in a blog at |http://myblog.mysite.com/entries/2006/05/04/03_2100/ then your post ID will be exactly the same as above.
Adds a new post to the blog.
appkey(string) | No longer used. Pass a dumby value. |
blogid(string) | Identifier for the blog. |
username(string) | Username to log in as. |
password(string) | The password to log in with. |
content(string) | The body text of the post. |
publish(boolean) | Whether or not to immediately publish the entry. If set to false, the entry will be saved as a draft. |
A string representation of the unique ID of this post.
Edit an existing post.
appkey(string) | No longer used. Pass a dumby value. |
postid(string) | Identifier for the post. |
username(string) | Username to log in as. |
password(string) | The password to log in with. |
content(string) | The new body text of the post. |
publish(boolean) | Whether or not to immediately publish the entry. The parameter is not currently used by LnBlog. |
True on success. On failure, a fault is raised.
Deletes the specified post.
appkey(string) | No longer used. Pass a dumby value. |
postid(string) | Identifier for the post. |
username(string) | Username to log in as. |
password(string) | The password to log in with. |
publish(boolean) | Whether or not to immediately publish the change. The parameter is not currently used by LnBlog. |
Gets a list of all blogs that a given user can add posts to.
appkey(string) | No longer used. Pass a dumby value. |
username(string) | Username to log in as. |
password(string) | The password to log in with. |
An array of structs containing the blog name, id, and URL.
Gets the information for the given user.
appkey(string) | No longer used. Pass a dumby value. |
username(string) | Username to log in as. |
password(string) | The password to log in with. |
A struct containing user's userid, firstname, lastname, nickname, email, and url. Note that not all of these necessarily apply to LnBlog, and so any field that is not found will be "faked" with a reasonable value or empty.
Gets the template used for the main or entry page. This doesn't apply to LnBlog and so always returns a "not implemented" message.
appkey(string) | No longer used. Pass a dumby value. |
blogid(string) | Identifier for the blog. |
username(string) | Username to log in as. |
password(string) | The password to log in with. |
templateType(string) | The type of template to get. |
Sets the template used for the main or entry page. This doesn't apply to LnBlog and so always returns a "not implemented" message.
appkey(string) | No longer used. Pass a dumby value. |
blogid(string) | Identifier for the blog. |
username(string) | Username to log in as. |
password(string) | The password to log in with. |
templateType(string) | The type of template to get. |
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.newPost | Creates a new post. |
metaWeblog.editPost | Edits an existing post. |
metaWeblog.getPost | Returns a representation of an existing post. |
metaWeblog.newMediaObject | Creates a new image, video file, etc. for the blog. |
metaWeblog.getCategories | Returns the categories known to the blog. |
metaWeblog.getRecentPosts | Returns a list of the most recently made posts. |
The configuration for the MetaWeblog API is exactly the same as for the Blogger API. You should use the same format for entry IDs and blog IDs as well as the same end-point URL. The only difference is in the commands sent to the server.
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.
Creates a new post.
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. |
A string representation of the unique ID of this post.
Change an existing post.
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. |
True on success, raises a fault on failure.
Get information for an existing post
postid(string) | Identifier for the post. |
username(string) | Username to log in as. |
password(string) | The password to log in with. |
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.
Uploads a file to the weblog over XML-RPC. New media objects are passed as structs, with 'name', 'type', and 'bits' fields. The 'bits' field is the base64-encoded data for the file.
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 file information. The struct must contain a 'name' field for the filename, a 'type' field for the file MIME type (LnBlog does not currently use this), and a 'bits' field that contains the base64-encoded file content. This implementation also accepts an 'entryid' field, which contains the unique ID of an entry to which the file will be uploaded. This only makes sense for blogging systems like LnBlog that allow per-entry uploads. |
A struct with a 'url' element that contains the HTTP or FTP URL to the file.
Gets a list of categories associated with a given blog.
blogid(string) | Identifier for the blog. |
username(string) | Username to log in as. |
password(string) | The password to log in with. |
A struct containing one struct for each category. The category structs must contain description, htmlUrl, and rssUrl elements. Note that LnBlog supplies RSS as an optional plugin, so the RSS URL may be empty.
Gets a list of the most recent posts to a blog.
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. |
An array of structs. The struct contents are as in the return value of the metaWeblog.getPost method.
The following MetaWeblog methods mirror the Blogger methods of the corresponding name. These methods were suggested by Dave Winer in this post http://www.xmlrpc.com/stories/storyReader$2460. However, for whatever reason, the MetaWeblog API spec was never ammended to include these. Does that mean they don't officially exist? I don't know.
A MetaWeblog alias of blogger.deletePost.
A MetaWeblog alias of blogger.getTemplate.
A MetaWeblog alias of blogger.setTemplate.
A MetaWeblog alias of blogger.getUsersBlogs.
The following methods are from the MovableType XML-RPC API. The reference is available at http://www.movabletype.org/mt-static/docs/mtmanual_programmatic.html.
Gets a stripped-down version of the recent posts list.
Gets a list of the category IDs and names for this blog.
Gets a list of the category IDs and names for this blog.
Gets a list of the category IDs and names for this blog.
A zero-parameter call that gets a list of the methods the server supports.
An array of all supported method names.
Gets a list text filtering plugins supported by the server. As LnBlog does not currently support this concept, this just returns an empty array.
An array of structs, with a key and a label field.
Gets the Trackback pings for a particular entry.
postid | The identifier for this post. |
An array of structs, each with a pingTitle, pingURL, and pingIP.
Rebuilds all static files for a particular post. Since LnBlog is currently all-dynamic and does not yet have unpublished posts, this method always returns true.
postid | The ID of the post to edit. |
username | The username with which to log in. |
password | The associated password. |
True on success, a fault on failure.