<script src="http://www.google.com/jsapi" type="text/javascript"></script> <script type="text/javascript"> google.load('gdata', '1.x'); google.setOnLoadCallback(initialize); function initialize() { var scope = 'http://docs.google.com/feeds/'; if (google.accounts.user.checkLogin(scope)) { var service = new google.gdata.client.GoogleService('writely', 'DocList-App-v1.0'); service.getFeed(scope + 'documents/private/full/', handleFeed, handleError); } else { var token = google.accounts.user.login(scope); // can ignore returned token } }; var handleFeed = function(response) { var entries = response.feed.entry; if (!entries.length) { alert('You have no entries!'); return; } var html = []; for (var i = 0, entry; entry = entries[i]; i++) { var title = entry.title.$t; html.push('<li>' + title + '</li>'); } document.getElementById('data').innerHTML = html.join(''); }; var handleError = function(e) { alert('Error: ' + e.cause ? e.cause.statusText : e.message); }; </script> <div id="data"><!-- dynamically filled --></div>
Using the JavaScript Client Library w/ non-supported Services
Posted by
Eric (Google)
on
Wednesday, December 03, 2008
The JavaScript client library has helper methods for Calendar, Contacts, Blogger, and Google Finance. However, you can use it with just about any Google Data API to access authenticated/private feeds.
This example uses the DocList API.
Labels:
DocList,
javascript
Subscribe to:
Post Comments (Atom)
469 comments:
«Oldest ‹Older 801 – 469 of 469Post a Comment