The Big Picture and How to Get Started


Published on

Jeff Scudder, Eric Bidelman

The number of APIs made available for Google products has exploded from a handful to a slew! Get
the big picture on what is possible with the APIs for everything from YouTube, to Spreadsheets, to
Search, to Translate. We'll go over a few tools to help you get started and the things these APIs share
in common. After this session picking up new Google APIs will be a snap.

Published in: Technology, News & Politics
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

The Big Picture and How to Get Started

  1. 1. The Big Picture and How to Get Started Jeff Scudder, Eric Bidelman 5/18/2010
  2. 2. Quick Poll
  3. 3. Google RESTful APIs
  4. 4. Why should you care? 60+ APIs AJAX APIs, Google Data, OpenSocial, Maps, many more Tools / Platforms Apps Marketplace, App Engine, Android, Chrome, "Your Site" Standard protocols HTTP, RESTful APIs Atom Publishing Protocol (XML), JSON, etc. OAuth Easy development most products have APIs (no need to start from scratch) open source client libraries Gain large user base build on top of popular Google services mashups with other web services
  5. 5. Why should you care? Developer Tools Google Web Toolkit (cross browser Java -> JS compiler) Web Elements (AJAX widgets) Chart Tools Google Eclipse Plugin Closure Tools (JS compiler, library) Secure Data Connector (access data behind the firewall) ... Platforms App Engine Android Chrome (extensions, HTML5 apps)
  6. 6. But we can't cover everything...
  7. 7. Today's Agenda Web Elements AJAX APIs Google Data Protocol APP, XML, REST, HTTP under the hood: raw protocol demo Authentication …because private data is more interesting Demos web applications, gadgets, mashups Questions & Answers
  8. 8. Google Ajax APIs
  9. 9. Available APIs Translate Language Detection Feeds Search News Local Image Video Blog Book Patent Custom (Web)
  10. 10. Adding custom search to your page <div id="cse" />
  11. 11. Adding custom search to your page google.load('search', '1');
  12. 12. Adding custom search to your page google.setOnLoadCallback( function(){ new CustomSearchControl(). draw('cse'); }, true);
  13. 13. Adding custom search to your page <!-- Google Custom Search Element --> <div id="cse" style="width:100%;">Loading</div> <script src="" type="text/javascript"> </script> <script type="text/javascript"> google.load('search', '1'); google.setOnLoadCallback(function(){ new'cse'); }, true); </script>
  14. 14. The Ajax Playground
  15. 15. Search APIs Google is known for search! LocalSearch, NewsSearch WebSearch, ImageSearch VideoSearch, PatentSearch BlogSearch, BookSearch Compatibility Firefox 1.5+, IE 6+, Safari, Opera 9+, Google Chrome Common loader google.load('search', '1'); google.load('gdata', '1.x', {packages:['blogger']}); google.load('maps', '2.s'); google.load('earth', '1'); google.load('jquery', '1.2.6', {uncompressed:true});
  16. 16. ...not just JavaScript REST, JSON Examples in Flash, PHP, Java ?v=1.0&q=Google%20IO"
  17. 17. HTTP? URL Client request to server
  18. 18. Example: Translate API Request GET 20world&langpair=en%7Cit q = hello world langpair = en|it
  19. 19. Example: Translate API Response { "responseData": { "translatedText":"ciao a tutti" }, "responseDetails": null, "responseStatus": 200 } translatedText = "ciao a tutti"
  20. 20. REST Create POST /calendar/feeds/default/allcalendars/full 201 Created Retrieve GET /calendar/feeds/default/allcalendars/full 200 OK Update PUT /calendar/feeds/default/allcalendars/full/{ID} 200 OK Delete DELETE /calendar/feeds/default/allcalendars/full/{ID} 200 OK
  21. 21. Google Data APIs
  22. 22. Google Data Protocol Basics HTTP, RESTful, ETags, OAuth GET / POST / PUT / DELETE (e.g. CRUD) Atom Publishing Protocol (XML), JSON, etc. Feature Google Atom RSS 2.0 Extends the APP Data authz for desktop/web/mobile Syndication Y Y Y data model (<gd: Format Queries Y N N lastModifiedBy>) batch operations Updates Y Y N responses formats (json, jsonc, Optimistic Y N N json-in-script) Concurrency GData-Version: 2.0 Authenticatio Y N N n
  23. 23. Example Request - Fetching Data GET /feeds/default/private/full/ HTTP/1.1 Host: GData-Version: 3.0 Authorization: OAuth oauth_token="ACCESS_TOKEN" ...
  24. 24. Example Request - Fetching Data GET /feeds/default/private/full/ HTTP/1.1 Host: GData-Version: 3.0 Authorization: OAuth oauth_token="ACCESS_TOKEN" ... HTTP/1.1 200 OK <feed xmlns='' xmlns:gd=''> <title>Available Documents -</title> <entry> <id></id> ... <title type='text'>Document Title</title> <category scheme="..." term="..." label="document"/> <content type="text/html" src="..."/> <link rel="alternate" type="text/html" href="..."/> <link rel="edit" href="..."/> <author>...</author> <gd:resourceId>document:abc123</gd:resourceId> <gd:lastViewed>2009-04-09T17:13:17.453Z</gd:lastViewed> ... </entry> <entry>...</entry> </feed>
  25. 25. Client Libraries Provide high level APIs to the protocol (better than XML!) Sample applications -
  26. 26. "What Can I Build?"
  27. 27. Search / Discovery APIs
  28. 28. Admin. / Data Management APIs
  29. 29. Content Creation / Publishing APIs
  30. 30. Apps / Office Productivity APIs
  31. 31. 20+ Data APIs and counting...
  32. 32. Wide variety of services
  33. 33. It's Your Data!
  34. 34. Authorization
  35. 35. Authorization Problems: Authentication is difficult Private resources Security considerations Solution: Let Google handle it! Authorization not Authentication Tokens not credentials User grants/denies access to their private data
  36. 36. OAuth Similar to AuthSub - single mode: ALL requests must be signed Web OR Desktop apps Open standard - popularity (Google, Twitter, Facebook, Yahoo, Flickr) - open source libraries: - reuse authentication code from another project
  37. 37. Demos
  38. 38. DEMO: Blogger Gadget
  39. 39. Read / Write JS Library Handles the details of loading data from Google Supports READ and WRITE operations Multiple authentication methods (AuthSub/OAuth Proxy) Works XD using iframe Wraps the function (in gadget environments) More info:
  40. 40. Blogger Gadget - creating data blogger.getBlogFeed('', function(resp) { postData(resp.feed.getEntries()[0]); }, handleError); function postData(blog) { var newEntry = new google.gdata.blogger.BlogPostEntry({ title: { type: 'text', text: 'New Blogger Gadget' }, content: { type: 'text', text: "Isn't Blogger great?" }, categories: [{ scheme: '',
  41. 41. Blogger Gadget - callback handlers function handleInsert(entryRoot) { var href = entryRoot.entry.getHtmlLink().getHref(); $('main').innerHTML = '<a href="' + href + '" target="new">View post</a>'; } function handleError(e) { var msg = e.cause ? e.cause.statusText + ': ' : ''; msg += e.message; alert('Error: ' + msg); }
  42. 42. "What Can I Build?"
  43. 43. Demo: Cloudie Java library Google Web Toolkit App Engine Docs / Spreadsheets * Screenshot from:, Developer: Bobby Soares
  44. 44. Relevant Sessions Bringing Google to your site Date: Tomorrow Time: 10:45am-11:45am Connecting your enterprise applications with Google Docs and Sites Date: Thursday Time: 11:30am-12:30pm
  45. 45. Resources Google Data APIs: OAuth Playground and other LIVE samples: AJAX APIs:
  46. 46. Questions?