introduction to google apis

37
Google APIs Why Aren’t You Using Them? Devesh Batra Blogger, Witty Geeks Unofficial Evangelist, Google Technologies [email protected]

Upload: deveshbatra

Post on 24-May-2015

321 views

Category:

Education


2 download

DESCRIPTION

Introduction to Google APIs is a free to use and share presentation that briefs the concept of Google APIs for a newbie.

TRANSCRIPT

Page 1: Introduction to Google APIs

Google APIsWhy Aren’t You Using Them?

Devesh BatraBlogger, Witty Geeks

Unofficial Evangelist, Google Technologies

[email protected]

Page 2: Introduction to Google APIs
Page 3: Introduction to Google APIs

API is a buzzword.

But what exactly is it??

Page 4: Introduction to Google APIs

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

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

What are Google APIs?

Page 7: Introduction to Google APIs

• 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

Some famous Google APIs

Available at: http://code.google.com/apis/console

Page 9: Introduction to Google APIs

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

Standards used by Google APIs:

WSDL, SOAP and ReST

Page 11: Introduction to Google APIs

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

• 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

• 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

How to start using Google

APIs?

Page 15: Introduction to Google APIs

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

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

Step 2

Click on the "Create Project" button.The following screen appears :

Page 18: Introduction to Google APIs

To continue learning Google APIs, let us take up the Google Maps API

Page 19: Introduction to Google APIs

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

Pre-requisite for Step 4:

What is OAuth?(Open Standard for

Authorization)

Page 21: Introduction to Google APIs

• 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

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

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

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

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

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

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

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

Some extremely famous and

interesting Google APIs

Page 30: Introduction to Google APIs

Google Maps Coordinate API

Page 31: Introduction to Google APIs

• 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

Google Docs & Spreadsheets API

Page 33: Introduction to Google APIs

• 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

Google Calendar API

Page 35: Introduction to Google APIs

• 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

…and many more.

Page 37: Introduction to Google APIs

Thank You!

Questions?Google Them or ask away!

Devesh BatraBlogger, Witty Geeks

Unofficial Evangelist, Google Technologies

[email protected]