AJAX Feed API Experiment - The RSS Blog
RSS, OPML and the XML platform.
Copyright 2012 World Readable
The RSS Blog
<< Previous Main Next >>
Fri, 20 Apr 2007 03:32:26 GMT
AJAX Feed API Experiment

I'm really thinking there's some great opportunity in Google's new AJAX Feed API. If you have a webpage that is a little thin on content, then you can use this service to add a little sidebar content. Let's go thru the steps of creating a bit of content using the API.

  1. Get an API key. Start by signing up and agreeing to the terms of use. This will give you an API key for use only with your website or blogsite. The key for kbcafe.com is ABQIAAAAAZAuqPpFrGeqNPBaRfnITxTW_YhViUY2BmmapWxnImsMBV7_XxQkg7DpGOrCCwM_GPvj50MfOhc9sg.
  2. Google will suggest some sample code. Cut that code and replace the feed URL with one of your chosing. Here's the code I get once I remove all the fluff and replace the feed URL. I chose the RSS feed for the rss-public mailing list.

    <script type="text/javascript" src="http://www.google.com/jsapi?key= ABQIAAAAAZAuqPpFrGeqNPBaRfnITxTW_YhViUY2BmmapWxnImsMBV7_XxQkg7DpGOrCCwM_GPvj50MfOhc9sg"></script>
    <script type="text/javascript">
    google.load("feeds", "1");
    function initialize() {
      var feed = new google.feeds.Feed("http://rss.groups.yahoo.com/group/rss-public/rss");
      feed.load(function(result) {
        if (!result.error) {
          var container = document.getElementById("rsspublic");
          for (var i = 0; i < result.feed.entries.length; i++) {
            var entry = result.feed.entries[i];
            var div = document.createElement("div");
    <div id="rsspublic" style='border: thick solid orange;'></div>

Now, let's paste this into the blog entry

Note that you don't actually get all the entries.  This is because you're not actually pulling the real RSS feed, but rather the version in the Google feed cache. In this case, I'm assuming that the Google does not cache older entries.

A pretty basic sample and very easy. Throw in a bit of formatting styles and you've got yourself some sidebar content.

Reader Comments Subscribe
Great Deals On Mattresses and Furniture-Phoenix Furniture Stores.
Type "339":
Top Articles
  1. Unblock MySpace
  2. MySpace
  3. FaceParty, the British MySpace
  4. del.icio.us and sex.com
  5. Blocking Facebook and MySpace
  1. Review of RSS Readers
  2. MySpace Layouts
  3. RSS Stock Ticker
  4. RSS Gets an Enema
  5. Google Reader rejects del.icio.us