Learn More

Friday, January 27, 2012

Basic Google Data Api

blogger logo
Google has a lot of services. As example youtube, blogger, google apps, sites, gmail, and others. All those services work under one data, known as Google Data Api. Basically, google data works based on xml. So we can manage google data with using any programming language.

Unfortunately, when this post is published, threelas not providing tutorial for xml. So, we give you suggestion to learn xml directly from http://w3schools.com/xml/default.asp. Even so, we are try to explain this as hard as possible.

Google data work with using xml feed. This feed then managed by one programming language. Fortunately, google also provide with other format, such as json. On the next posting, we will discuss it. For best practice, we hope you make one blog as dummy, read our previous post, google data api.

Get Your Blog Data

Let say you want to access data of your blog, and then the first time to doing this is request data to google server with Get method, like follow:

GET   feed-blog-url

Say your blog address is http://example.blogspot.com, than your feed-blog-url (xml feed) is http://example.blogspot.com/feeds/posts/default . After you request, server will check is that data inside database. If that data is not broken, server will response it and sent your blog post data like follow:

Inside that xml feed, contains information of title, author, blog id, post id, etc. If you want to know your xml feed, you can do that by open your feed-blog-url on address bar of your browser. Then view the page source. Remember, you will never open your feed-blog-url if your blog is not public. If your blog is not public, then the first step to open your xml feed is doing authentication.

Post Your Blog Post Data

When you want to create any post, you must using POST method to doing that, but you must doing authentication before create any post. Format for create a new post is

POST  feed-blog-url

If your feed-blog-url (xml feed) is not broken link, then google server will response it with sent a new data on your xml feed. In here, you will see published tag. This tag will created automatically as you publish your post. Once again, to create authentication, you must have Api Key. And to get Api Key you must create it on Google Api Console.

Update Your Blog Post Data

Sometimes you need to update your post, you can do this by giving PUT method, but you must specific your post id,

PUT feed-post-url

If your feed-post-url (xml post feed) is not broken link, then google server will response it with sent a new data on your xml feed. You must also remember, before you update your post, you must doing authentication first.

That’s all you need for the first time. We are so sorry; we didn’t give you tutorial for deleting an entry. Because, deleting an entry will make your blog is hurt and decrease your rank.

Post a Comment