roller-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Levine <>
Subject RE: Programmatic blog entries
Date Wed, 19 Mar 2008 17:16:41 GMT

Just in case any one else is interested in this, here's what I've found out:

As Finbar suggested, go here:

>From there you can download the src for the BlogPoster, along with some other projects.

The BlogPoster is one java file and one config file.  I ended it up rewriting it for my own
needs and pulled it into my project.  

You'll need these jars to compile/run the example (they are included in the download, you
just have to add them to your classpath):

The code that does the work is this:
       client.execute ( "metaWeblog.editPost",
            new Object[] { postId, userName, password, post, Boolean.TRUE } ) ;

The example shows you how you can create a new post with a title, description, and the creation
date.  The guts of the post is a Hashtable called post.  The boolean value at the end is a
publish flag.  If you set it to Boolean.FALSE it will save the entry as a draft, rather than
a published entry.

One thing I thought was a bit weird was that the "description" was actually the body of the
blog entry.  I couldn't find a way to set the summary.
You can also set multiple categories by creating a Vector<String> and putting the category
names in there.  Then I added the vector to the post Hashtable with the key "categories"

If you set the date for the time in the future, it will schedule publishing time for that

You can also edit a post by changing the first argument in this code:
Integer result = (Integer) client.execute("metaWeblog.newPost",

to this :

and also change the blogId (the handle for your blog) to the postId, a very long string that
looks like this -- 1ab7c416-1231-42eb-a4e8-2g323e67bf30
When you create a blog entry, using this API, it returns that string, so I save it away in
a DB for future editing

There are also ways to get the available categories, get recent posts, and a add a media object.
 I didn't experiment with those.

Hope this is helpful to someone.  Feel free to email me if you have any questions.


> Date: Mon, 17 Mar 2008 20:46:14 +0100
> To:
> Subject: Re: Programmatic blog entries
> From:
> Brian,
> There is a lot of useful code over at the Blogapps site (an off shoot of 
> the book 'RSS and Atom In Action' by Dave Johnson):
> One of these is a blog poster:
> Blogposter simple XML-RPC example
> Roller supports the Blogger API so any client that understands this is fine.
> Name: Finbar Dineen
> Web:
> Brian Levine wrote:
> > 
> > Hi, I'm just getting started using Roller 4.  As part of my blog, I'd like to be
able to add blog entries programmatically.  So, instead of using the HTML authoring form and
manually typing in a blog entry, I'd like to be able to run my java program to create the
HTML and then stick that HTML into a blog post.
> > 
> > I've already written the part that generates the HTML, so I'd like to know if creating
and editing blog entries is possible without using the HTML editor.
> > 
> > 
> > Thanks!
> > /Brian
> > 
> > _________________________________________________________________
> > Climb to the top of the charts! Play the word scramble challenge with star power.
> >

Shed those extra pounds with MSN and The Biggest Loser!
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message