Atom API Documentation for Blogger
Note:
Blogger's Atom 0.3 API (as described below) will soon be deprecated — please update your apps to use the Blogger/GData API. Thanks!
— Eric and the Blogger team, 2006/08/16
Table of Contents
- Overview
- Authentication
- Get a list of User's Blogs
- Get an Atom Feed of a Blog
- Get an Atom Entry of a Post
- Create a new Post
- Save a Post as Draft
- Edit an existing Post
- Delete a Post
- Failures
- Blogger Extensions
- Typical Uses
- Known Issues
Overview
An Atom API Request is made of 4 pieces: the Method, the Resource, the Authentication, and the Entry. Not all requests need an Entry, but all requests need the first three.
- the Atom API Request is an HTTP Request.
- the Method is an HTTP Method.
- the Resource is a URI
- the Authentication is HTTP Basic Authentication
- the Entry is an XML Document sent as the body of the HTTP request
Authentication
Every Atom API request is authenticated by using HTTP Basic Authentication over SSL.
Get a List of a User's Blogs:
GET /atom HTTP/1.1 Host: www.blogger.com Authorization: BASIC c3RldmVqOm5vdGFyZWFscGFzc3dvcmQ=
Which will return:
<?xml encoding="UTF-8"?> <feed version="0.3"> <link rel="service.feed" href="https://www.blogger.com/atom/1" title="my first blog." type="application/x.atom+xml" /> <link rel="service.post" href="https://www.blogger.com/atom/1" title="my first blog." type="application/x.atom+xml" /> <link rel="service.feed" href="https://www.blogger.com/atom/2" title="fromage blog" type="application/x.atom+xml" /> <link rel="service.post" href="https://www.blogger.com/atom/2" title="fromage blog" type="application/x.atom+xml" /> </feed>
You'll get one service.feed
and one service.post
for each blog of which you're a member. The service.post
is the URI where you would send an Entry to post to your blog. The service.feed
is the URI where you would make an Atom API request to see the Blog's latest entries.
To see a list of your recent Posts:
GET /atom/3187374 HTTP/1.1 Host: www.blogger.com Authorization: BASIC c3RldmVqOm5vdGFyZWFscGFzc3dvcmQ=
This will return an Atom feed containing the last 15 posts.
To see a specific Post:
GET /atom/3187374/1123937362671 HTTP/1.1 Host: www.blogger.com Authorization: BASIC c3RldmVqOm5vdGFyZWFscGFzc3dvcmQ=
This will return a single Atom entry, outside of a feed.
To create a new entry:
POST /atom/3187374 HTTP/1.1 Content-type: application/xml Host: www.blogger.com Authorization: BASIC c3RldmVqOm5vdGFyZWFscGFzc3dvcmQ= <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <entry xmlns="http://purl.org/atom/ns#"> <title mode="escaped" type="text/plain">atom test</title> <issued>2004-04-12T06:07:20Z</issued> <generator url="http://www.yoursitesurlhere.com">Your client's name here.</generator> <content type="application/xhtml+xml"> <div xmlns="http://www.w3.org/1999/xhtml">Testing the Atom API</div> </content> </entry>
To save an entry as Draft:
Blogger uses a namespace with an optional element called draft
. The only valid children of draft are true
and false
. If draft
is left out of a newly created post, it is assumed to be published. If draft
is left out of an edited post then the post's draft status will not change. Here is an example of the syntax:
<draft xmlns="http://purl.org/atom-blog/ns#">false</draft>
To edit an existing entry:
PUT /atom/3187374/112393873673 HTTP/1.1 Content-type: application/xml Host: www.blogger.com Authorization: BASIC c3RldmVqOm5vdGFyZWFscGFzc3dvcmQ= <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <entry xmlns="http://purl.org/atom/ns#"> <title mode="escaped" type="text/html">atom test</title> <issued>2004-04-12T06:07:20Z</issued> <generator url="http://www.yoursitesurlhere.com">Your client's name here.</generator> <content type="application/xhtml+xml" xml:lang="en-US" xml:space="preserve"> <div xmlns="http://www.w3.org/1999/xhtml"><em>Update:</em> Testing the Atom API</div> </content> </entry>
To delete a Post:
DELETE /atom/3187374/112983287376436 HTTP/1.1 Host: www.blogger.com Authorization: BASIC c3RldmVqOm5vdGFyZWFscGFzc3dvcmQ=
If your delete was successful, you should receive:
HTTP/1.1 204 No Content
Failures:
If unable to authenticate your request, the server will respond with:
HTTP/1.1 401 Unauthorized WWW-Authenticate: BASIC realm="Blogger"
Your username/password is invalid.
When developing your client, this error is most likely to occur from encrypting
the PasswordDigest
incorrectly or getting the format of the HTTP request wrong.
After you're done debugging your client, the most likely culprit of this error will be user error. For example, trying to delete a Post that doesn't belong to them but they can still see — a Blogger user can see all posts made in any team blogs they're a part of. They won't be able to delete them, though.
If the blog or post doesn't exist, you will get a 404
error.
Blogger Extensions:
<convertLineBreaks>
— Line Break status. This flag, when set to true
, means that a blog's posts will have their newlines automatically converted to <br />
. If set to false
, newlines will not be transformed. This flag is read-only and can only be changed through the Blogger web interface for now. You can see a blog's Line Break status by sending a GET to it's service.feed
URI and looking for it as a child of the <feed>
element:
<convertLineBreaks xmlns="http://www.blogger.com/atom/ns#">true</convertLineBreaks>
Typical uses
Most consumer facing clients will probably act this way:
- A user enters their username/password combination.
- The client software sends a request to
https://www.blogger.com/atom
with the HTTP credentials - Blogger authenticates the user and sends back a list of the user's blogs
- The user picks the blog they want to edit
- The client sends a request to the
service.feed
URI with the HTTP credentials - Blogger authenticates the request and returns the User's latest 15 Posts
- The user edits an older entry
- The client sends the updated entry to the Blog's
service.edit
URI (which is included in the Post Atom entry) - If the User decides to create a new Post, then the client sends an Atom entry to the
service.post
URI
Known Issues
We maintain a list of AtomAPI Known Issues in Blogger Help, as well as a list of third-party apps that integrate with Blogger in some way.
Visit the Blogger Developers Network.