Learn More

Friday, December 7, 2012

Learn Basic Blogger API v3

blogger gear
After you read our tutorial about google authentication, now we go to real of basic blogger API v3. In this post we discuss first step in basic blogger API v3 and the example. About example, we provide interactive control, so that you can be more understand about blogger API v3. Again, in this post we using REST system. Because, the output of this system is JSON, in which is more familiar for many people. Of course, output of interactive control below is also in JSON. For how to use JSON output to implemented for certain purpose, we will discuss it on the next topic. Ok, let's go start.

Basically Blogger is built on five basic concepts:
  1. Blogs: The root concept of the API. A blog has posts and pages. This is the container for blog meta-information like blog name and Description.
  2. Posts: A blog post is the publishable item that the blog author has created. This information is meant to be timely, reflecting what the authors want to publish to the world now. It is understood that as time passes, blog posts content ages and becomes less relevent.
  3. Comments: A comment is the place where people other than the blog post author react to what the author has written. Everything from bricks to bouquets.
  4. Pages: A page is a place for static content, such as biographical information, or the ways to contact the user. This is generally timeless information that doesn't change very often.
  5. Users: A user is someone who interacts with Blogger, be they acting as an Author, an Administrator, or just a Reader. For public blogs, readers may be anonymous, but on private blogs a reader must be identified by Blogger.
On the other side, the Blogger JSON API operates on five types of resources:

  1. Blogs resource: Represents a blog.
  2. Posts resource: Represents a post; each posts resource is a child of a blogs resource.
  3. Comments resource: Represents a comment on a specific post; each comments resource is a child of a posts resource.
  4. Pages resource: Represents a static page; each pages resource is a child of a blogs resource.
  5. Users resource: Represents a non-anonymous user. This is used to identify the Author of a page, post, or comment.
 See the picture below, how exactly Blogger JSON API work

blogger resource

On the image above, you will not see Users Resource, because other resources are inside of Users Resource. So, Users Resource is main source in Blogger JSON API. From the picture above, we can get a simple summary. That is, if we use Blogs Resource, then we can get Posts Resource, Comments Resource, and Pages Resource. But, can not get Posts Resource if we use Comments Resource. In practice, the implementing of each resources depend on the condition. If you only want to get recent posts then Posts Resource is the solution. But if you just want to get recent comments, then Comments Resource is more good.

Like what we explained above, that in this post we discuss how to use blogger API v3 with REST (Representational State Transfer). And blogger API v3 has collection of secure HTTP protocol like below


Each secure HTTP must be passed with authentication such as access token value. So that, you must add ?access_token=TOKEN_VALUE after each secure HTTP. As example, "https://www.googleapis.com/blogger/v3/users/self?access_token=TOKEN_VALUE".

All access_token value depend on scope of Blogger API. Below is collection of Blogger API scopes.


Attention, if you use second scope, then you only can see without do anything. Blogger also use method for each secure HTTP. Such as GET, POST, PUT, DELETE. The interactive control below is using GET method, so it save for you to try demo of blogger API v3. And also we use secure HTTP
https://www.googleapis.com/blogger/v3/blogs/{blogId} (use firebug to see the JSON output)

Blog ID Scope

Post a Comment