[go: up one dir, main page]

As you may have noticed, the Blogger Development Network Blog looks a lot different today. That’s because we—along with a few other Google blogs—are trying out a new set of Blogger templates called Dynamic Views. Launched today, Dynamic Views is a unique browsing experience that makes it easier and faster for readers to explore blogs in interactive ways. We’re using the Classic view, but you can also preview this blog in any of the other six new views by using the view selection bar at the top left of the screen. We’re eager to hear what you think about the new Dynamic Views. You can submit feedback using the “Send feedback” link on the bottom right of this page. If you like what you see here, and we hope you do, we encourage you to try out the new look(s) on your own blog—read the Blogger Buzz post for more info.

Today we’re announcing the public availability of the Blogger JSON API we spoke about at this year’s Google I/O. The focus of this release is to make it easier to build applications that interoperate with Blogger by using a lightweight JSON syntax.

One of the driving reasons for this release is to recognize how much the world has changed during the lifetime of Blogger. Where once we built everything as desktop applications, we now spend our time building full-blown applications inside the browser frame using JavaScript and HTML5 apps.

To start using the Blogger JSON API, sign in to the Google API Console and request Blogger API access. This will take you to a form that asks you to explain how you intend to use the API, and an estimate of your daily traffic levels. This information helps us evaluate your request for approval and give us a better understanding of how the community is using our APIs as we work to improve them.

To demonstrate how much easier this API is to use, especially for JavaScript mashups, here is a JavaScript renderer for the Blogger Buzz blog.

<html>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
  <script>
  // Request an API Key for the Blogger API from 
  // https://code.google.com/apis/console/
  var apikey = "YOUR API KEY HERE";
  
  // You can find the blogId in the HTML source of a blog
  var blogId = "2399953";
  
  // When the document is loaded
  $(document).ready(function() {
   
    // Make a JSONP request for the Posts on the Blogger Buzz blog
    $.ajax({
      url:"https://www.googleapis.com/blogger/v2/blogs/”+
        blogId+”/posts?key="+apikey,
      dataType: "jsonp",
      success: function(data, textStatus, jqXHR) {
        var items = [];   
        // Construct a chunk of HTML for each post
        // containing the Post title, content, and a 
        // link to the post author.
        $.each(data.items, function(index, value) {
          items.push("<h2>"+value.title+"</h2>"+value.content+
            "<p>Posted by <em><a href='"+value.author.url+"'>"+
            value.author.displayName+"</a></em></p>");
        });

        // And finally, append the generated content to the page body.
        $(items.join('')).appendTo('body');
      }
    });
  });
  </script>
</html>

It is important to understand that this release is the first step on a journey of discovery, as we work with all of you to build a better API for using Blogger. Please review the documentation, and join in the discussion on Blogger Developer Group and let us know what we can add to the API to make it more useful for you!