Print Friendly

In my continuing quest to use Google Apps as best I can, I’ve been reading up on the Google Blogger API.

I thought that automatically backing up a blog on Blogger would be easy, but it turned out to be a more complex script that I had originally thought.

Authentication was the part that I was missing. Using curl, I can acquire the authentication information like so:

curl -s -d -d Passwd=mypassword -d accountType=GOOGLE -d source=blog-backup -d service=blogger

From this line, you get output like so:


The line we’re interested in is the one starting with “Auth=”. This is what we will use to authenticate to blogger so that we can grab our blog backup.

Part two consists of downloading the XML backup of all of your posts.

I knew that I could go to the following URL to get a backup of my blog posts:

where I fill in blogid with the blogID supplied by your URL on Blogger. For example, as I type this, the URL in the address bar is

which tells me that my blogID is 6964696676319111700.

So, to download the blog backup, I use the following URL:

With the use of the tool curl and some Bourne Shell scripting, the following script can be used to automatically download my XML file containing a backup of my blog from Blogger.

# Authentication and authorization
export Auth=`curl -s -d -d Passwd=mypassword -d accountType=GOOGLE -d source=blog-backup -d service=blogger | grep "Auth="`
# Get the xml file and store it into blog-backup.xml
curl -H "Authorization: GoogleLogin ${Auth}" "" &gt; blog-backup.xml<span style="font-size: 85%;">

Now I set cron to run this script once a week and I will have a backup of my blog entries should something horrible befall blogger; or I choose another blogging service.