introduction to google apis

Post on 24-May-2015

321 Views

Category:

Education

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

Google APIsWhy Aren’t You Using Them?

Devesh BatraBlogger, Witty Geeks

Unofficial Evangelist, Google Technologies

devesh@wittygeeks.com

API is a buzzword.

But what exactly is it??

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.”

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.”

What are 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.

Some famous Google APIs

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

Account Authentication

AdSense

AdWords

Calendar

Checkout

Spreadsheets

YouTube

Search

Maps

BloggerEarth

GadgetsGroups

Picasa

Search History

Site Maps

Talk

And many more..

Standards used by Google APIs:

WSDL, SOAP and ReST

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.

• 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)

• 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)

How to start using 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.

Step 1

Go to https://code.google.com/apis/console/, and log in with your Google Account.The following will appear:

Step 2

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

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

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

Pre-requisite for Step 4:

What is OAuth?(Open Standard for

Authorization)

• 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

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

In the next screen, you have got an API key, and it will look something like this:

Step 5

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);

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);

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);

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);}});

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:

Some extremely famous and

interesting Google APIs

Google Maps Coordinate API

• 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

Google Docs & Spreadsheets API

• 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

Google Calendar API

• 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

…and many more.

Thank You!

Questions?Google Them or ask away!

Devesh BatraBlogger, Witty Geeks

Unofficial Evangelist, Google Technologies

devesh@wittygeeks.com

top related