Introduction to Google APIs
-
Upload
deveshbatra -
Category
Education
-
view
319 -
download
2
description
Transcript of Introduction to Google APIs
![Page 1: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/1.jpg)
Google APIsWhy Aren’t You Using Them?
Devesh BatraBlogger, Witty Geeks
Unofficial Evangelist, Google Technologies
![Page 2: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/2.jpg)
![Page 3: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/3.jpg)
API is a buzzword.
But what exactly is it??
![Page 4: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/4.jpg)
Wikipedia says: “An application programming interface (API) is a protocol
intended to be used as an interface by software components to communicate with each other. An API is a library that may include specifications for routines, data structures, object classes, and
variables.”
![Page 5: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/5.jpg)
To cut things short,“An application programming interface (API) is specification intended to be used as an interface by software components to
communicate with each other.”
![Page 6: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/6.jpg)
What are Google APIs?
![Page 7: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/7.jpg)
• The Google APIs service is a web program that enables
developers to easily find and manipulate information on the web.• Google APIs are for developers and researchers interested in
using Google products and services as a resource in their applications.
• Google uses the SOAP and WSDL standards to act as an interface between the user’s program and Google API.
• Programming environments such as Java, Perl, Visual Studio .NET are compatible with Google API.
![Page 8: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/8.jpg)
Some famous Google APIs
Available at: http://code.google.com/apis/console
![Page 9: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/9.jpg)
Account Authentication
AdSense
AdWords
Calendar
Checkout
Spreadsheets
YouTube
Search
Maps
BloggerEarth
GadgetsGroups
Picasa
Search History
Site Maps
Talk
And many more..
![Page 10: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/10.jpg)
Standards used by Google APIs:
WSDL, SOAP and ReST
![Page 11: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/11.jpg)
WSDL(Web Services Description Language)
• The standard format for describing a web service. • Expressed in XML, a WSDL definition describes how to access
a web service and what operations it will perform. • This is the most important file (only) to use the API with Perl.
![Page 12: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/12.jpg)
• is a communication protocol.• is for communication between applications. • is a format for sending messages.• is designed to communicate via Internet.• is platform independent.• is language independent.• is based on XML.
SOAP(Simple Object Access Protocol)
![Page 13: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/13.jpg)
• light weight.• suitable for Web APIs. • Ease of development and deployment.• Serves the actual purpose of HTTP.• Cache Proxies.• Human Readable Results.• Better Perfomance, Better Support.• Social Media Authentication.
ReST(Representational State Transfer)
![Page 14: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/14.jpg)
How to start using Google
APIs?
![Page 15: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/15.jpg)
Before you start, you will need a specific API key from Google.
The key is free, and is required to complete this process.
![Page 16: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/16.jpg)
Step 1
Go to https://code.google.com/apis/console/, and log in with your Google Account.The following will appear:
![Page 17: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/17.jpg)
Step 2
Click on the "Create Project" button.The following screen appears :
![Page 18: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/18.jpg)
To continue learning Google APIs, let us take up the Google Maps API
![Page 19: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/19.jpg)
In the list of services, find Google Maps API v3, and click on "off" to turn it on.
In the next screen, check "I Agree..." and the click the "Accept" button. You will now see that the button next to Google Maps API v3 has changed to "on".
Step 3
![Page 20: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/20.jpg)
Pre-requisite for Step 4:
What is OAuth?(Open Standard for
Authorization)
![Page 21: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/21.jpg)
• provides a method for clients to access server resources on behalf of a resource owner (such as a different client or an end-user).
• provides a process for end-users to authorize third-party access to their server resources without sharing their credentials (typically, a username and password pair), using user-agent redirections.
• OAuth 2.0 allows users to share specific data with you (for example, contact lists) while keeping their usernames, passwords, and other information private. A single project may contain up to 20 client IDs.
OAuth
![Page 22: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/22.jpg)
Then click "API Access" in the menu to the left. It will ask you to "Create an OAuth 2.0 client id...".
In the next screen, provide a product name (e.g. "demo"), upload an image (if you want to) as a logo of your project, and click the "Next" button.
In the next screen, choose Application type ("Web application"), and type in your web address, and then click the "Create Client Id" button.
Step 4
![Page 23: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/23.jpg)
In the next screen, you have got an API key, and it will look something like this:
Step 5
![Page 24: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/24.jpg)
Step 6
Now, it takes two lines of code to get a Google map on your page.
var map = new GMap2(document.getElementById("map"));map.setCenter(new GLatLng(40.146212, -82.994824), 13);
![Page 25: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/25.jpg)
Step 7
A few more lines results in maps controls for zoom and pan.
var map = new GMap2(document.getElementById("map"));var point = new GLatLng(40.146212, -82.994824);map.addControl(new GLargeMapControl());map.addControl(new GMapTypeControl());map.addControl(new GOverviewMapControl());map.setCenter(point, 13);
![Page 26: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/26.jpg)
Step 8
You can also add events to almost anything on the map.
var map = new GMap2(document.getElementById("map"));var point = new GLatLng(40.146212, -82.994824);GEvent.addListener(map, "moveend",
function() {var center = map.getCenter();alert("MAP CENTER: \n" +
center.toString());});GEvent.addListener(map, "mouseout“,
function() {alert(“You’re done dragging?");});
map.setCenter(point, 13);
![Page 27: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/27.jpg)
Step 9All of this stuff is great, but what if you don’t know your latitude and longitude?
var address = "8850 S. Old St. Rd., Columbus, OH 43240";var map = new GMap2(document.getElementById("map"));var geocoder = new GClientGeocoder();geocoder.getLatLng(address,
function(point){if (point){map.setCenter(point, 13);var marker = new GMarker(point);map.addOverlay(marker);marker.openInfoWindowHtml(address);}});
![Page 28: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/28.jpg)
Web Application – Accessed by Web browsers over a networkService Account – Calls Google APIs on your behalf instead of the end-userInstalled Application – Runs on a desktop computer or a handheld device
To conclude the steps, 3 broad applications of APIs are:
![Page 29: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/29.jpg)
Some extremely famous and
interesting Google APIs
![Page 30: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/30.jpg)
Google Maps Coordinate API
![Page 31: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/31.jpg)
• workforce management tool that improves the efficiency of mobile teams. • All team members can be seen on a Google Map, making it easy to assign
jobs to the nearest available team member. • By getting real-time visibility into where teams are and what jobs they are
doing, work can be scheduled in a smarter, more efficient way. • Administrators can dispatch jobs with the confidence that an individual's
location is correct, even if they are indoors since Google Maps Coordinate integrates with Google Indoor Maps.
Google Maps Coordinate API
![Page 32: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/32.jpg)
Google Docs & Spreadsheets API
![Page 33: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/33.jpg)
• Google Documents List Data API allows developers to build applications that can upload documents to Google Docs, request a list of a user’s documents, or search content within a document.
• Google Spreadsheets API performs similar functions, allowing external applications to access and edit data within the company’s spreadsheet program.
• A good example of these relatively new APIs in action is Swivel, where data can be pulled in from Google Spreadsheets and then utilize Swivel’s community tools for analyzing and discussing data.
Google Docs & Spreadsheets API
![Page 34: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/34.jpg)
Google Calendar API
![Page 35: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/35.jpg)
• workforce management tool that improves the efficiency of mobile teams. • All team members can be seen on a Google Map, making it easy to assign
jobs to the nearest available team member. • By getting real-time visibility into where teams are and what jobs they are
doing, work can be scheduled in a smarter, more efficient way. • Administrators can dispatch jobs with the confidence that an individual's
location is correct, even if they are indoors since Google Maps Coordinate integrates with Google Indoor Maps.
Google Calendar API
![Page 36: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/36.jpg)
…and many more.
![Page 37: Introduction to Google APIs](https://reader034.fdocuments.in/reader034/viewer/2022052204/55615249d8b42a857d8b500d/html5/thumbnails/37.jpg)
Thank You!
Questions?Google Them or ask away!
Devesh BatraBlogger, Witty Geeks
Unofficial Evangelist, Google Technologies