Monday, November 08, 2010 at 12:00 AM.

system.verbs.apps.blogger.newPost

on newPost (text, username=nil, password=nil, blogId=nil, flPublish=true, adrdata=@blogger.data) {
	<<Changes
		<<8/12/01; 11:35:06 AM by DW
			<<Call blogger.init. Change parameter order, if username, password and blogId are not supplied, get values from user.blogger.
		<<8/9/01; 12:28:47 PM by JES
			<<This sample script shows how to create a new post on a Blogger site, using XML-RPC.
			<<http://samples.userland.com/stories/storyReader$204
			<<To use it, you must first be a registered Blogger user, and have a site.
			<<The parameters are as follows:
				<<username -- Your Blogger username.
				<<password -- Your Blogger password.
				<<blogId -- The ID of your Blogger site (a.k.a. Blog). You can get the ID of your Blog from the URL you use to edit it in the browser. It's the number after blogid= in the URL.
				<<text -- The text that you want to post to your site.
				<<flPublish -- A boolean which specifies whether the Blog will be published when creating the post. The default is true.
				<<adrdata -- The address of a data table, which contains information needed to communicate with the Blogger server. The default is @workspace.userlandSamples.blogger.data, which is pre-configured.
			<<This script returns the post ID, as returned by the server.
			<<More info:
				<<The Blogger API documentation from Evan Williams:
					<<http://plant.blogger.com/api/
				<<The bloggerDev mailing list:
					<<http://groups.yahoo.com/group/bloggerDev
	blogger.init ();
	bundle { //set defaults
		if username == nil {
			username = user.blogger.username};
		if password == nil {
			password = string (user.blogger.password)};
		if blogId == nil {
			blogId = user.blogger.blogId}};
	with adrdata^ {
		local (params = {appkey, string (blogId), string (username), string (password), string (text), boolean (flPublish)});
		return (xml.rpc (server, port, "blogger.newPost", @params, rpcPath:rpcPath, protocol:protocol))}};
bundle { //test code
	dialog.alert (newPost ("Now is the time for all good men to come to the aid of their country."))}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.